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 Andreas Hochsteger <an...@gmail.com> on 2007/02/21 15:02:08 UTC

Top 10 results with faceted queries

Hi,

is it possible to do a faceted search and additionally returning the
first 10 results for each facet (or category) in one query?

I have the requirement to produce a page like this:

Category 1:
 - Link 1
 - Link 2
 - ...
 - Link 10

Category 2:
 - Link 1
 - Link 2
 - ...
 - Link 10

...

Category n:
 - Link 1
 - Link 2
 - ...
 - Link 10

The naive approach would be to perform separate solr queries for each
category, take to top 10 and aggregate the results.
This works, but it's really slow, since there may be up to 40
categories on one page.

Any help is highly appreciated!

Thanks,
Andreas

Re: Top 10 results with faceted queries

Posted by Chris Hostetter <ho...@fucit.org>.
: is it possible to do a faceted search and additionally returning the
: first 10 results for each facet (or category) in one query?

There no way to do something like this "out of the box" but if you are
familiar with java it would be fairly straight forward to write a custom
RequestHandler that does ... it could subclass StandardRequestHandler and
let "super" do the bulk of the work, inspecting the SolrQueryResponse to
add the extra info before returning.

: The naive approach would be to perform separate solr queries for each
: category, take to top 10 and aggregate the results.
: This works, but it's really slow, since there may be up to 40
: categories on one page.

this wouldn't neccessarily get much faster if it was all in a single
request handler ... the caching that is used to make facet counts fast
should help ensure that if you iteratively query for each constraint to
get the "first n" matching docs those constraints and their doc sets
should already be in the cache -- assuming you currently have
<useFilterForSortedQuery>true</useFilterForSortedQuery> in your solrconfig
(and you are requesting that the results be sorted by soemthing other then
score), that cache should already be getting used ...  you might see just
as much speed up in performance by using persistent HTTP connections (ie:
Keep-Alive) when you make hte subsequent queries as you would if you did a
bunch of work to put the logic ina RequestHandler.


-Hoss


SV: Top 10 results with faceted queries

Posted by Antonio Eggberg <an...@yahoo.se>.

Andreas Hochsteger <an...@gmail.com> skrev:
The naive approach would be to perform separate solr queries for each
category, take to top 10 and aggregate the results.
This works, but it's really slow, since there may be up to 40
categories on one page.

I have also the same question. As far as I can tell reading from the list is that you have to do "pre-computed quires" in advance (I am guessing some sort of a cron job and then save them in a text file.. just guessing) due to load constrains etc.. There is some discussion on the list but I don't know the exact procedure.

If you do find out about I would appreciate an answer.

Regards



 		
---------------------------------

Stava rätt! Stava lätt! Yahoo! Mails stavkontroll tar hand om tryckfelen och mycket mer! Få den på http://se.mail.yahoo.com