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 Chris Hostetter <ho...@fucit.org> on 2009/12/01 00:15:42 UTC

Re: Sorting Facets by First Occurrence

: 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.


-Hoss


Re: Sorting Facets by First Occurrence

Posted by Cory G Watson <jh...@gmail.com>.
On Nov 30, 2009, at 5:15 PM, Chris Hostetter wrote:
> 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.


You are right, I left out a few important bits there.  Tried to be brief and succeeding in being vague? :)

Effectively I was ordering the facet based on the N documents in the current "page".  My thought that his was a good feature for a facet now seems incorrect, as my needs are limited to the current page, not the whole set of results.

I'll probably elect to fetching data from the facets based on the page of documents I'm showing.  Thanks for the discussion, it helped! :)

Cory G Watson
http://www.onemogin.com