You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Stephane Gamard <st...@searchbox.com> on 2012/10/19 15:18:17 UTC

Getting count for Multi-Select Faceting

Hi all, 

Congrats on the 4.0.0 delivery, it's a pleasure to work with! 

I have a small problem that I am trying to "elegantly" resolve: while using multi-select faceting it might happen that a facet is selected which is not part of the facet list (due to limit for example). When executing the query I cannot then get the facet's value count as it still outside of the scope of the limit. 

for a sample query: 
http://192.168.160.2:8983/solr/select?fq={!tag=scat}category:Article&facet.field={!ex=scat}category&q=*:*&facet=true&facet.limit=5&facet.mincount=1

I have the following results:

<lst name="facet_fields">
<lst name="category">
<int name="Organic Papers">6225</int>
<int name="Metal-Organic Papers">3055</int>
<int name="Research Papers">236</int>
<int name="Inorganic Papers">187</int>
<int name="Addenda and Errata">59</int>
</lst>
</lst>

Note that the facet (category:Article) is not present within the facet_fields result. I've thought of running 2 facet queries where one is not tagged and merge the 2 list within the UI. Is that the best solution available, or should the facet of fq be present (as sticky) within the facet_list? 

Cheers, 

_Stephane

Re: Getting count for Multi-Select Faceting

Posted by fbrisbart <fb...@bestofmedia.com>.
Did you look think of using 'facet.query' ?
Adding '&facet.query=category:Article' to your url should return what
you expected.

Franck Brisbart



Le vendredi 19 octobre 2012 à 15:18 +0200, Stephane Gamard a écrit :
> Hi all, 
> 
> Congrats on the 4.0.0 delivery, it's a pleasure to work with! 
> 
> I have a small problem that I am trying to "elegantly" resolve: while using multi-select faceting it might happen that a facet is selected which is not part of the facet list (due to limit for example). When executing the query I cannot then get the facet's value count as it still outside of the scope of the limit. 
> 
> for a sample query: 
> http://192.168.160.2:8983/solr/select?fq={!tag=scat}category:Article&facet.field={!ex=scat}category&q=*:*&facet=true&facet.limit=5&facet.mincount=1
> 
> I have the following results:
> 
> <lst name="facet_fields">
> <lst name="category">
> <int name="Organic Papers">6225</int>
> <int name="Metal-Organic Papers">3055</int>
> <int name="Research Papers">236</int>
> <int name="Inorganic Papers">187</int>
> <int name="Addenda and Errata">59</int>
> </lst>
> </lst>
> 
> Note that the facet (category:Article) is not present within the facet_fields result. I've thought of running 2 facet queries where one is not tagged and merge the 2 list within the UI. Is that the best solution available, or should the facet of fq be present (as sticky) within the facet_list? 
> 
> Cheers, 
> 
> _Stephane