Sorting facets by relevance

2013-05-15 Thread Jan Morlock
Hi,

we are using faceted search for our queries. However neither sorting by
count nor sorting by index as described in [1] is suitable for our business
case. Instead, we would like to have the facets (or at least the beginning
of them) sorted by the score of the top document possessing the
corresponding facet. The expected behaviour can be compared to what the
result grouping feature does (see [2]).

I am currently thinking about the following strategy:
(1) Create a new search component
(2) Perform a sub-query using grouping
(3) Use the result of this sub-query in order to sort the facets of the
actual query.

Currently step no. 2 seems to be pretty difficult. Can anybody point a me to
an example, where a sub-query is performed in order to retrieve the groups?
Or does anybody have a better/easier strategy for achieving this?

Any help is appreciated.
Thank you very much in advance.

Best regards
Jan

[1]: http://wiki.apache.org/solr/SimpleFacetParameters#facet.sort
[2]: http://wiki.apache.org/solr/FieldCollapsing



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Sorting-facets-by-relevance-tp4063649.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Sorting facets by relevance

2013-05-15 Thread Mikhail Khludnev
There is Lucene faceting module, which doesn't do anything in common with
Solr, but it looks like it has something what you are looking for.
http://shaierera.blogspot.com/2012/11/lucene-facets-part-1.html


On Thu, May 16, 2013 at 1:33 AM, Jan Morlock jan.morl...@googlemail.comwrote:

 Hi,

 we are using faceted search for our queries. However neither sorting by
 count nor sorting by index as described in [1] is suitable for our business
 case. Instead, we would like to have the facets (or at least the beginning
 of them) sorted by the score of the top document possessing the
 corresponding facet. The expected behaviour can be compared to what the
 result grouping feature does (see [2]).

 I am currently thinking about the following strategy:
 (1) Create a new search component
 (2) Perform a sub-query using grouping
 (3) Use the result of this sub-query in order to sort the facets of the
 actual query.

 Currently step no. 2 seems to be pretty difficult. Can anybody point a me
 to
 an example, where a sub-query is performed in order to retrieve the groups?
 Or does anybody have a better/easier strategy for achieving this?

 Any help is appreciated.
 Thank you very much in advance.

 Best regards
 Jan

 [1]: http://wiki.apache.org/solr/SimpleFacetParameters#facet.sort
 [2]: http://wiki.apache.org/solr/FieldCollapsing



 --
 View this message in context:
 http://lucene.472066.n3.nabble.com/Sorting-facets-by-relevance-tp4063649.html
 Sent from the Solr - User mailing list archive at Nabble.com.




-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

http://www.griddynamics.com
 mkhlud...@griddynamics.com


Sorting Facets by First Occurrence

2009-11-30 Thread Cory Watson
I'm working on replacing a custom, internal search implementation with
Solr.  I'm having great success, with one small exception.

When implementing our version of faceting, one of our facets had a
peculiar sort order.  It was dictated by the order in which the field
occurred in the results.  The first time a value occurred it was added
to the list and regardless of the number of times it occurred, it
always stayed at the top.

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:

facet.fields - category - [ Toys: 1, Sports: 8 Household: 1 ]

The facet.sort only gives me the option to sort highest count first or
alphabetically.

So, the question I _really_ have is: how can I implement this feature?
 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.

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


Re: Sorting Facets by First Occurrence

2009-11-30 Thread Chris Hostetter

: 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

2009-11-30 Thread Cory G Watson

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





Sorting facets

2006-11-04 Thread Walter Lewis
My apologies if this has been answered before but I couldn't see it in 
the FAQ, tutorial or wiki or the solr-user mail archives.


The explanation for sorting the documents returned by a search is quite 
straight foward. I'm currently seeing the facets arriving in a more 
random order.


Is the expectation that the code processing the result will apply its 
own sorts to the facet lists?  or is there some other option I'm 
overlooking?


Walter Lewis