Sunday, August 3, 2014

[SOLR] Implementing Facet with multiple categories along with their count

How can we facet on more than two categories ( ‘project’ and ‘type’ as discussed below) and at the same time get the combination facets and their count.

Example : http://search-lucene.com/

When you open URL, http://search-lucene.com/?q=facets you can see the facets on right hand side as 'Project','type','date','author' and their corresponding values with count in brackets.

For instance, let’s say you select 'solr(32857)' under 'Project' facet, still we can see other values under 'Project' facet like ElasticSearch etc. along with their respective count. 







Further when we Select 'mail # user(23138)' under “type” section , again we can see other values under “type” section with their corresponding count in brackets and their corresponding values in “Project” facet gets changed accordingly (namely the count ). 




Observe how solr(32857) changed to Solr (22969) post selection of mail # user along with the other values of ‘Project’ (like ElasticSearch etc.) and ‘type’ (issue, javadoc etc.,) with a change in their count values.

To achieve similar functionality you can use following solution:

Use Tagging and excluding Filters: http://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters

select?q=solr%20facets&fq={!tag=projectTag}Project:"solr"&fq={!tag=typeTag}type:"mail # user"&facet=true&facet.field={!ex=projectTag}project&facet.field={!ex=typeTag}type&wt=json&indent=true

Using the above solution I am able to implement the faceting solution mentioned in above website using SOLR.

Hope this is useful information for your all!!!!



No comments:

Post a Comment

Password Protected Solr Admin Page

As we all know Solr Admin Page is not password protected and anyone can get into Solr Admin Page. However this article will ...