Time for action – using a hierarchical facet (pivot)

If we are using facets, we probably need to move horizontally on the data without imposing a specific, single hierarchy, even for a single field. This is useful and very flexible as the facets could also be combined with each other, but this should not be seen as a limit when we want to manage taxonomy or a structured, controlled dictionary. The usage of hierarchical faceting is rather simple, and it is based on the well-known pivot column navigation pattern, yet to be available in some database applications.

The idea is that we will provide a list of of field names, and the results will be constructed over them. We can use the following query:

>> curl -X 'http://localhost:8983/solr/paintings/select?q=artist:dali&facet.pivot=artist_entity,city_entity,museum_entity&facet=true&facet.field=city_entity&facet.limit=10&rows=0&wt=json&indent=true&facet.pivot.mincount=1'

Another example for the query is shown as follows, and it will probably be more restrictive:

>> curl -X GET 'http://localhost:8983/solr/paintings/select?q=artist:dali&rows=0&facet=on&facet.field=city_entity&facet.pivot=city_entity,museum_entity,artist_entity&facet.limit=1&facet.mincount=3&wt=json'

What just happened?

In the first example, we are asking you to use a hierarchy of artists, cities, and museums as pivots. So, we will expect a result where for every artist we search over cities, and then over museums. We should expect, in most cases, to find some different nested results, with low result count. If we use a different criteria for pivoting, such as city_entity, museum_entity, and artist_entity, we will not be surprised to obtain less pivot results, with a good relative match count, as shown in the following screenshot:

What just happened?

In this case, we are indeed looking for paintings by a specific artist at a specific museum, which is probably a more natural approach and it will be faster to read the results too. Note that when we are interested in adopting this particular approach, we are also able to offer a sort of breadcrumb to the users in order to make it easy for them to remember the current selection. We should avoid confusion with an actual navigation on the data. We are still using facets and their capabilities to give us suggestions on directions for moving later into the data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.19.185