1
votes

Request you to please help me in fixing the below facets problem. Thanks in advance. Also pls let me know if you do not understand any part of my explanation below.

How do I facet on more than two categories (let’s say ‘project’ and ‘type’ as discussed below) at the same time to get combination facets and their count ? 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(3366)' under 'Project' facet, still I can see other values under 'Project' facet like ElasticSearch etc. along with their respective count. Project: solr(3366) -- selected ElasticSearch (1650) Lucene (1255) Lucene.Net (43) Nutch (20) PyLucene (17) Mahout (16) ManifoldCF (8) Tika (4) OpenRelevance (3) Lucy (2) type: mail # user (2791) issue (303) mail # dev (134) source code (82) javadoc (37) wiki (36) web site (2)

  1. Further when I Select 'mail # user(2791)' under “type” section , again I 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 ). project: Solr (2784) -- selected ElasticSearch (1056) Lucene (237) Lucene.Net (24) Nutch (14) Mahout (10) ManifoldCF (4) Lucy (2) OpenRelevance (1) type mail # user (2791) -- selected issue (303) mail # dev (134) source code (82) javadoc (37) wiki (36) web site (2)

    Observe how solr(3366) changed to Solr (2784) 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.

I want to achieve similar working functionality. Can you pls let me know if the below query is in the correct direction. Pls let me know if I have to modify this. if yes, what and how. Probably an explanation on why would do a huge help.

localhost:8080/solr/collection1/select?q=facets&fq=Project%3A(%22solr%22)&fq=type%3A(%22mailhashuser%22)&facet=true&facet.mincount=1&facet.field=project&facet.field=type&wt=json&indent=true&defType=edismax&json.nl=map

If the above query is not in the correct direction. Pls help in constructing the same. Thanks in advance.

Kind Regards, Vamshi

1

1 Answers

1
votes

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

Example: I have 2 Facets color and shape.

Color: Red Green yellow

Shape: Circle Square

So if I select "Red" then green and yellow should be present in facet list and all shapes as well.

The following query worked for me.

/select?q={!tag=dt1}color:red&fq={!tag=dt2}shape:*&facet=true&facet.field={!ex=dt1}color&facet.field={!ex=dt2}shape

Using the above solution I am able to resolve the exact issue that you have iterated in above question.

This solution will really help you in resolving your issue

Unable to use Tagging and excluding Filters

Let me know if it resolve your issue.

Regards,

Jayesh Bhoyar