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 Shamik Bandopadhyay <sh...@gmail.com> on 2014/07/04 02:15:48 UTC

How to get related facets using Solr query ?

Hi,

   I've trying construct a facet query to organize related facets in the
response. Let me illustrate a sample. Let's say I've the following
documents indexed in Solr.

1. Doc A -->
                  Facet:AB
                  Facet:MNO

2. Doc B -->
                  Facet:CD
                  Facet:XYZ

3. Doc C --> Facet:AB,CD
                   Facet:IJK, XYZ


Now, I want the result organized as :

AB
    MNO,XYZ
CD
    IJK,XYZ

Is there a way to do this ?

Thanks,
Shamik

Re: How to get related facets using Solr query ?

Posted by shamik <sh...@gmail.com>.
Thanks for the pointer Eric. You are right, I forgot to include "IJK" under
AB. Also, facet field names are different. Unfortunately, I'm using
Solrcloud and facet pivot doesn't seem to work in a distributed mode. I'll
get back some result if I use distrib=false, but then it's not the right
data.



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-get-related-facets-using-Solr-query-tp4145580p4145684.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to get related facets using Solr query ?

Posted by Erik Hatcher <er...@gmail.com>.
Why isn't IJK not under AB too?

Are the "Facet" field names different?  Pivot facets looks like what you want.  facet.pivot=field1,field2 if they are different field names. 

   Erik

> On Jul 3, 2014, at 20:15, Shamik Bandopadhyay <sh...@gmail.com> wrote:
> 
> Hi,
> 
>   I've trying construct a facet query to organize related facets in the
> response. Let me illustrate a sample. Let's say I've the following
> documents indexed in Solr.
> 
> 1. Doc A -->
>                  Facet:AB
>                  Facet:MNO
> 
> 2. Doc B -->
>                  Facet:CD
>                  Facet:XYZ
> 
> 3. Doc C --> Facet:AB,CD
>                   Facet:IJK, XYZ
> 
> 
> Now, I want the result organized as :
> 
> AB
>    MNO,XYZ
> CD
>    IJK,XYZ
> 
> Is there a way to do this ?
> 
> Thanks,
> Shamik