Faceted search and filter exclusion in Solr

Faceted search is for organizing the search results into classifications. The returned result of faceted search and regular search will be the same, but the faceted search will give you a classification of the search result. For example, search for “laptop”, the result set from a faceted search and regular search will be same, but the faceted search will give you a extra information about the result, a summary of classification like this:
Manufacturer

  • Acer(11)
  • Apple(9)
  • Dell(21)
  • HP(15)
  • Sony(12)
  • Toshiba(18)

Solr allow you to do filter exclusion in faceted search. Search filters are ingored when it does the faceting(classifications). Search filter is the terms and conditions you specified in the search query. For example, I want to search for a laptop manufactured by Dell. “lattop” and “Dell” are the filters. In a faceted search without filter exclusion for this query will give me the results I wanted, but the classifications will be off. There will be only one classification of manufactuerer because the query already filtered out laptop manufactured by other manufacturers.
Manufacturer

  • Dell(21)

With a filter exclusion in a faceted search query, I can search for laptop manufactured by Dell and also tell the query to ignore the filter(manufacturer=Dell) when doing faceting so it will still give me the classfications of all available manufacturers. As an example, this query does the filter exclusion in a faceted search. It tag filter manufacturer that directly constrain the search results, and exclude the manufacturer filter on faceting.

q=mainquery&fq=product:laptop&fq={!tag=mf}manufacturer:Dell&facet=on&facet.field={!ex=mf}manufacturer

Search within Codexpedia

Custom Search

Search the entire web

Custom Search