What is Solr facet search
The concept of facet is one of the killer features of Solr, sounds like a fancy word but actually pretty simple and easy to understand.
For a generic search, you can categorize the results by various characteristics or aspects, for example searching for books, the results can be categorized by author or publish date, facet is a particular category. If the total number of results is 100, there may be 10 of them with the author for example James, if you only interested in that particular author, you can choose the facet, now you have less candidates to choose from.
Facet value and facet count
Suppose a generic search generate 100 results, there is a facet called author, suppose there are 3 authors by total: James, Smith, Bob. Those author values are facet values, each facet value contains a slice of results of total results, for example, it may be distributed like James(20), Smith(50), Bob(30). These hit numbers are facet count. Its very similar to a pie chart, each facet is a pie chart in which each facet value slices a portion of the whole result set.
The facet serves as a kind of categorized guide to navigate through the search results, its also called facet navigation or facet browsing, guided navigation, parametric search.
Its very similar to a group by search in SQL, suppose you have a generic search
SELECT * FROM books WHERE title LIKE '%solr%'
And then narrow it down by a category for example the author:
SELECT COUNT AS COUNT(*), author FROM books GROUP BY author WHERE title LIKE '%solr%' AND author = 'james'
Facet search is typically used in e-commerce site, because each product has many different aspects: brand, price range, size, weight, each user has their own preferences on those aspects, they may wish to apply their preferences when searching products. Facet search is almost a must for e-commerce site. For example the Amazon, when you search something, it provide a category on the left side of search result panel.
Search "computer" in Amazon:
The total number of results is huge for such a generic search, there are about 10 millions products matched it. But there are only about 18 thousands laptop computers in results.
Now if you only interest in the laptop computer, you can choose that category which will largely narrow down the total search results.
After you choose one facet, there are more detailed facets you can choose to narrow it down further. For example , for all laptop computers, you only interest in Mac OSX and the memory capacity must be 12GB and above. After apply these facets, the results reduced to 23.
Solr
Solr Basics
Solr Configuration
Overview
solrconfig.xml
solr.xml
schema.xml