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 Paul <pa...@nines.org> on 2012/02/29 17:52:13 UTC

searching top matches of each facet

Let's say that I have a facet named 'subject' that contains one of:
physics, chemistry, psychology, mathematics, etc....

I'd like to do a search for the top 5 documents in each category. I
can do this with a separate search for each facet, but it seems like
there would a way to combine the search. Is there a way?

That is, if the user searches for "my search", I can now search for it
with the facet of "physics" and rows=5, then do a separate search with
the facet of "chemistry", etc...

Can I do that in one search to decrease the load on the server? Or,
when I do the first search, will the results be cached, so that the
rest of the searches are pretty cheap?

Re: searching top matches of each facet

Posted by Paul <pa...@nines.org>.
Perfect! Thanks!

On Wed, Feb 29, 2012 at 3:29 PM, Emmanuel Espina
<es...@gmail.com> wrote:
> I think that what you want is FieldCollapsing:
>
> http://wiki.apache.org/solr/FieldCollapsing
>
> For example
> &q=my search&group=true&group.field=subject&group.limit=5
>
> Test it to see if that is what you want.
>
> Thanks
> Emmanuel
>
>
> 2012/2/29 Paul <pa...@nines.org>:
>> Let's say that I have a facet named 'subject' that contains one of:
>> physics, chemistry, psychology, mathematics, etc....
>>
>> I'd like to do a search for the top 5 documents in each category. I
>> can do this with a separate search for each facet, but it seems like
>> there would a way to combine the search. Is there a way?
>>
>> That is, if the user searches for "my search", I can now search for it
>> with the facet of "physics" and rows=5, then do a separate search with
>> the facet of "chemistry", etc...
>>
>> Can I do that in one search to decrease the load on the server? Or,
>> when I do the first search, will the results be cached, so that the
>> rest of the searches are pretty cheap?

Re: searching top matches of each facet

Posted by Emmanuel Espina <es...@gmail.com>.
I think that what you want is FieldCollapsing:

http://wiki.apache.org/solr/FieldCollapsing

For example
&q=my search&group=true&group.field=subject&group.limit=5

Test it to see if that is what you want.

Thanks
Emmanuel


2012/2/29 Paul <pa...@nines.org>:
> Let's say that I have a facet named 'subject' that contains one of:
> physics, chemistry, psychology, mathematics, etc....
>
> I'd like to do a search for the top 5 documents in each category. I
> can do this with a separate search for each facet, but it seems like
> there would a way to combine the search. Is there a way?
>
> That is, if the user searches for "my search", I can now search for it
> with the facet of "physics" and rows=5, then do a separate search with
> the facet of "chemistry", etc...
>
> Can I do that in one search to decrease the load on the server? Or,
> when I do the first search, will the results be cached, so that the
> rest of the searches are pretty cheap?