lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Prasad <umesh.i...@gmail.com>
Subject Re: Query on Facet
Date Sun, 03 Aug 2014 01:03:52 GMT
You can use pivot faceting.

https://wiki.apache.org/solr/SimpleFacetParameters#Pivot_.28ie_Decision_Tree.29_Faceting

There is no index time work required and you can nest the facets at search
time as for your need.

PS : It won't work with SolrCloud / Sharded Index ..  SOLR-2894 is in
progress if you need distributed faceting.

Example ;

&facet=true&facet.pivot=binding_string,language_string

binding_string,language_string: [

   - {
      - field: "binding_string",
      - value: "Paperback",
      - count: 882,
      - pivot: []
      },
   - {
      - field: "binding_string",
      - value: "Hardcover",
      - count: 169,
      - pivot: []
      },
   - {
      - field: "binding_string",
      - value: "P",
      - count: 454,
      - pivot: [
         - {
            - field: "language_string",
            - value: "English",
            - count: 198
            },
         - {
            - field: "language_string",
            - value: "Spanish",
            - count: 44
            },
         - {
            - field: "language_string",
            - value: "German",
            - count: 27



On 31 July 2014 11:25, Alexandre Rafalovitch <arafalov@gmail.com> wrote:

> Now it sounds like maybe you have nested facets as opposed to just
> different ones. See if one of these fits your use case better:
> http://wiki.apache.org/solr/HierarchicalFaceting
>
> Regards,
>    Alex.
> Personal: http://www.outerthoughts.com/ and @arafalov
> Solr resources and newsletter: http://www.solr-start.com/ and @solrstart
> Solr popularizers community: https://www.linkedin.com/groups?gid=6713853
>
>
> On Thu, Jul 31, 2014 at 12:22 PM, Smitha Rajiv <smitharajiv23@gmail.com>
> wrote:
> > Hi All,
> >
> > We have tried both exclude option as well as facet query. Both approach
> are
> > not giving us the desired results.
> >
> > I will explain a little further. I have first level facets - Paperback
> and
> > Ebook, and second level facets include a list of languages like English,
> > French etc..
> >
> > When user selects 'Paperback', then currently i am getting all the
> > languages of paperback. But "Ebook" is not getting in result. But i can
> > resolve this by using exclude for the first level facet.
> >
> >  Now I am facing issue for the second level facet. When the user selects
> > 'Paperback' and 'English', then the query returns only 'Paperback' in
> first
> > level and 'English'  in second level. But I need other languages (which
> > satisfies paperback) also, so that I can show them in second level.
> >
> > We tried with facet.query as well as facet.field options. Please find the
> > query below.
> >
> >
> >
> http://localhost:8080/solr/collection1/select?q=software%20testing&fq=language%3A(%22English%22)&fq=Binding%3A(%22paperback%22)&facet=true&facet.mincount=1
> > &facet.field=Language&facet.field=latestArrivals&facet.f
> > ield=Binding&wt=json&indent=true&defType=edismax&json.nl=
> > map&facet.field=language&facet.field=binding.
> >
> >
> >
> http://localhost:8080/solr/collection1/select?q=software%20testing&fq=language%3A(%22English%22)&fq=Binding%3A(%22paperback%22)&facet=true&facet.mincount=1
> > &facet.field=Language&facet.field=latestArrivals&facet.f
> > ield=Binding&wt=json&indent=true&defType=edismax&json.nl=
> > map&facet.query=language&facet.query=binding.
> >
> >
> > Please provide your thoughts.
> >
> >
> > Thanks & Regards,
> >
> > Smitha
> >
> >
> >
> >
> >
> > On Wed, Jul 30, 2014 at 8:18 PM, Sujit Pal <sujit.pal@comcast.net>
> wrote:
> >
> >> Hi Smitha,
> >>
> >> Have you looked at Facet queries? It allows you to attach Solr queries
> to
> >> facets. The problem with this is that you will need to know all possible
> >> combinations of language and binding (or make an initial query to find
> this
> >> information).
> >>
> >>
> >>
> https://wiki.apache.org/solr/SimpleFacetParameters#facet.query_:_Arbitrary_Query_Faceting
> >>
> >> Another alternative could be to bake in language+binding pairs into a
> field
> >> in your index and facet on that.
> >>
> >> -sujit
> >>
> >>
> >>
> >> On Wed, Jul 30, 2014 at 7:01 AM, vamshi kiran <
> mothevamshikiran@gmail.com>
> >> wrote:
> >>
> >> > Hi Alex,
> >> >
> >> > As you said If we exclude language facet field ,it will get all the
> >> > language facets with count right ?
> >> > It Will not filter by binding facet field of type 'paperback'  , how
> can
> >> we
> >> > do this ?
> >> >
> >> > Thanks & Regards,
> >> > Vamshi.
> >> > On Jul 30, 2014 4:11 PM, "Alexandre Rafalovitch" <arafalov@gmail.com>
> >> > wrote:
> >> >
> >> > > I am not sure I fully understood your question, but I would start
by
> >> > > looking at Tagging and Excluding first:
> >> > >
> >> > >
> >> >
> >>
> https://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters
> >> > >
> >> > > Regards,
> >> > >    Alex.
> >> > > Personal: http://www.outerthoughts.com/ and @arafalov
> >> > > Solr resources and newsletter: http://www.solr-start.com/ and
> >> @solrstart
> >> > > Solr popularizers community:
> >> https://www.linkedin.com/groups?gid=6713853
> >> > >
> >> > >
> >> > > On Wed, Jul 30, 2014 at 5:07 PM, Smitha Rajiv <
> smitharajiv23@gmail.com
> >> >
> >> > > wrote:
> >> > > > Hi,
> >> > > >
> >> > > >
> >> > > > I need some help on Solr Faceting.
> >> > > >
> >> > > >
> >> > > > How do I facet on two fields at the same time to get combination
> >> facets
> >> > > and
> >> > > > its count?
> >> > > >
> >> > > > I'm using below query to get facets with combination of language
> and
> >> > its
> >> > > > binding. But now I'm getting only selected  facet in facetList
of
> >> each
> >> > > > field and its count.  For e.g.  in language facets the query
is
> >> > returning
> >> > > > "English" and its count. Instead I need to get other language
> facets
> >> > > which
> >> > > > satisfies binding type of paperback
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > >
> >> >
> >>
> http://localhost:8080/solr/collection1/select?q=software%20testing&fq=language%3A(%22English%22)&fq=Binding%3A(%22paperback%22)&facet=true&facet.mincount=1
> >> > > >
> >> > > >
> >> > >
> >> >
> >>
> &facet.field=Language&facet.field=latestArrivals&facet.field=Binding&wt=json&indent=true&defType=edismax&
> >> > > > json.nl=map
> >> > > >
> >> > > >
> >> > > >
> >> > > > Please provide me your inputs.
> >> > > >
> >> > > >
> >> > > > Thanks & Regards,
> >> > > >
> >> > > > Smitha
> >> > >
> >> >
> >>
>



-- 
---
Thanks & Regards
Umesh Prasad

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message