lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Sorting Facets by First Occurrence
Date Mon, 30 Nov 2009 23:15:42 GMT

: I'm working on replacing a custom, internal search implementation with
: Solr.  I'm having great success, with one small exception.
: For example, if a search yielded 10 results, 1 - 10, and hit 1 is in
: category 'Toys', hit 2 through 9 are in 'Sports' and the last is in
: 'Household' then the facet would look like:

...and what if you had 100,000 results?  did it really look at every doc 
that matched a query to decide the facet ordering, or did it stop at 10?

: So, the question I _really_ have is: how can I implement this feature?

It depends ... how was the previous version implemented?

(you mentioned it was a custom internal solution, so i assume you have 
access to the code and can explain it to us in psuedo code ... that would 
give people the best insight into what exactly it was doing to make a 
Solr based comparison)

:  I could examine the results i'm returned and create my own facet
: order from it, but I thought this might be useful for others.  I don't
: know my way around Solr's source, so I though dropping a note to the
: list would be faster than code spelunking with no light.

All of Solr's existing faceting code is based on the DocSet which is an 
unordered set of all matching documents -- i suspect your existing 
application only reordered the facets based on their appearance in the 
first N docs (possibly just the first page, but maybe more) so doing 
something like that using the DocList would certainly be feasible.  if 
your number of facet constraints is low enough that they are all returned 
everytime then doing it in the client is probably the easiest -- but if 
you have to worry about facet.limit preventing something from being 
returned that might otherwise bubble to the top of your list when you 
reorder it then you'll need to customise the FacetComponent.


View raw message