Facet searching

In Solr, a facet provides us with a way to arrange the result into categories based on the index terms. For example, in our musicCatalogue, we can arrange the songs based on genre (for example, rock, pop, world music, and so on). This feature is very helpful in e-commerce websites, where we need to see data in a categorical way. Let's see how we can enable faceting in our search queries. There are no special settings needed to get faceting to work in our musicCatalogue example.

Let's open the query browser tab for our musicCatalgoue example from the Solr Admin UI. This time, in the query input fields, we'll enable the facet checkbox and input the genre field in the facet.field textbox, like this:

After clicking on Execute Query

Get Apache Solr for Indexing Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.