Search code examples
solrfilterfacet

Solr facet.query for query, without filter.query


Is there any way to get facet.query results only for the main query, without a facet.filter query. For example, I have the request:

q=item_id:* 
&fq=item_param:3 
&facet.query=item_param:1
&facet.query=item_param:2

Is it possible to get facets from all item results (item_id:*), not from fq (item_param:3)?


Solution

  • This can be done by tagging and excluding filters. First, you want to tag your filter queries with a tag (e.g., filters):

    fq={!tag=filters}item_param:3
    

    Second, tell your facet queries to ignore the tag you used for the filters:

    facet.query={!ex=filters}item_param:1
    facet.query={!ex=filters}item_param:2