Jeffrey Tiong wrote:
>
> Hi,
> 
> I have a schema that has the following fields,
> 
> publisher_name
> book_title
> year
> abstract
> 
> Currently if I do a facet count when I have a query "q=abstract:philosophy
> AND publisher_name:publisher1" , it can give me results like below,
> 
> <str name="q">abstract:philosophy AND publisher_name:publisher1</str>
> <lst name="book_title">
>      <int name="book1"> 70 </int>
>      <int name="book2"> 60 </int>
>      <int name="book3"> 20 </int>
> </lst>
> <lst name="year">
>      <int name="1990"> 78 </int>
>      <int name="1991"> 62 </int>
>      <int name="1992"> 19 </int>
> </lst>
> 
> 
> Likewise for "q=abstract:philosophy AND publisher_name:publisher2" -
> 
> <str name="q">abstract:philosophy AND publisher_name:publisher2</str>
> <lst name="book_title">
>      <int name="book1"> 3 </int>
>      <int name="book2"> 1 </int>
>      <int name="book3"> 1 </int>
> </lst>
> <lst name="year">
>      <int name="1989"> 3 </int>
>      <int name="1990"> 1 </int>
>      <int name="1992"> 1 </int>
> </lst>
> 
> 
> However I have to do the query separately and get the facet count for each
> of them separately. Is there a way for me to combine all these into one
> query and get the facet count for each of them at one query?  because
> sometimes it may go up to 20 queries in order to get all the separate
> counts.
> 
> 
> Thanks!

Hi Jef,

I don't know of a way to answer your question directly, but I believe
that filter queries are "cache efficient".  To present the options:

    q=abstract:philosophy&facet=true&facet.limit=-1&facet.mincount=1
      &facet.field=book_title&facet.field=year&facet.field=publisher_name

You can use this to collect (and present?) the various facet counts,
then to limit the scope to what you show above, append the different
filter queries in turn:

    fq=publisher_name:publisher1
    fq=publisher_name:publisher2

Cheers,


-- 
Phil

The really frightening thing about middle age is the knowledge that
you'll grow out of it.
        -- Doris Day (1924--), US actress/singer

Reply via email to