Solr graphs are taken into account with selective exception

I'm not sure if this is possible, but I would like to be able to control the counts returned for faces more closely than just including and excluding.

In particular, I have an interface that allows users to filter "facetA" and "facetB". It's a bit like this

  Filter by
     - facetA: article (20), image (6), activity (14)
     - facetB: cats (23), dogs (12), hedgehogs (5)

The interface makes it clear that facetA is higher in the hierarchy than facetB. I would like facetA to be considered fully persistent, and facetB is also considered permanent, but depends on the choice of facetA.

Thus, the interface can respond to facetB changes with:

  Filter by
     - facetA: article (20), image (6), activity (14)
     - facetB: cats (23), dogs (12), hedgehogs (5)

i.e. none of the readings changes.

But he would respond to a change to facetA as follows:

  Filter by
     - facetA: article (20) , image (6), activity (14)
     - facetB: cats (15), dogs (4), hedgehogs (1)

ie, facetB counts the change to reflect what is available after applying the facetA filter.

Just do

& facet.field = {! ex = dt} fieldA & facet.field = {! ex = dt} fieldB

does not reach what I want, but he is close. I find that the instructions on this are very vague in the solr quiz - for example, I don’t even know what β€œdt” means. Can anyone clarify? Can I get more control over how exceptions are calculated?

+7
source share
2 answers

Ok, I figured it out. 'dt' is a user-specified tag that is set using the {! tag = *} and refers to the expression {! ex =}.

So, the above example is fixed if you add the following to my query:

&fq={!tag=tagA}fieldA:facetASelection &fq={!tag=tagB}fieldB:facetBSelection &facet=true &facet.field={!ex=tagA}fieldA &facet.field={!ex=tagB}fieldB 

This means that selecting (fq) for facetA does not affect counters for facetA, and choosing (fq) facetB does not affect counts for facetB.

Sweet! I almost came to terms with sending a few requests to get the information I needed.

+9
source

Thanks. This answer saved me almost a day later.

I basically followed the example from http://wiki.apache.org/solr/SimpleFacetParameters ie

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

Therefore, when I have several faces, I still used {!tag=dt} & {!ex=dt} on both faces.

Note: as correctly marked dt is a user-defined tag that is used on this face. Therefore, if I use dt for both facets, I do not get the expected response.

Instead of => use 'dt1' & 'dt2' ... for multiple faces or as described in the example above use 'tagA' , 'tagB' ....

Thanks again for your previous post.

+3
source

All Articles