Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr multiple filter tagging / excluding

I am trying to apply filter tagging for Solr search Tagging_and_excluding_Filters.

The challenge is to apply multiple tagging at the same time (for multiple select options on a single page). e.g.

q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&fq={!tag=doc}document:1&facet=on&facet.field={!ex=dt}doctype&facet.field={!ex=doc}document

But for some reason excluding works only for one filter and other gets unnoticed. Is there any problem with my syntax? Can anyone suggest a better method?

like image 268
insightful Avatar asked Jan 23 '12 08:01

insightful


3 Answers

I'm having a similiar problem to solve and it seemed to work by just using a comma to seperate excluded tags:

From: http://wiki.apache.org/solr/SimpleFacetParameters#facet.field

Filter exclusion is supported for all types of facets. Both the tag and ex local params may specify multiple values by separating them with commas.

So I guess you'd use it like: {!ex=doc,dt}

like image 132
Daniel W. Avatar answered Oct 11 '22 17:10

Daniel W.


This answer may not be timely, but i think this should resolve your issue.

Try adding both the tags in both the ex clauses. I did that and it worked for me for a similar case.

q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&fq={!tag=doc}document:1&facet=on&facet.field={!ex=dt,doc}doctype&facet.field={!ex=dt,doc}document
like image 26
Sarthak Dudhara Avatar answered Oct 11 '22 18:10

Sarthak Dudhara


Possibly the http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams section would help you further than the from you mentioned one.

Best regards!

like image 30
Omnaest Avatar answered Oct 11 '22 17:10

Omnaest