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 Esteve Camps Chust <ec...@gmail.com> on 2008/04/29 20:17:31 UTC
Sorting results
Hi,
I want to know if is posible the next kind of Sorting:
I perform the search like Matahari. The returned results may include "A big
life: Matahari", "War and Matahari", "Matahari" (in that order). How can I
return results by sorting at first the results that matches the begiging of
string? I want to score higher the results that starts with search string
than the other matches.
Thanks in advance.
Esteve
Re: Sorting results
Posted by Chris Hostetter <ho...@fucit.org>.
: I perform the search like Matahari. The returned results may include "A big
: life: Matahari", "War and Matahari", "Matahari" (in that order). How can I
: return results by sorting at first the results that matches the begiging of
: string? I want to score higher the results that starts with search string
: than the other matches.
what you're describing is mainly a function of scoring (sorting may be by
score, or by a concrete field value)
scoring documents higher when the term appears closer to the begining of
the field can be done using a SpanFirstQuery, but Solr doesn't use
SpanFirstQueries by default -- you'd need to write a plugin.
FWIW: if what you really want is to score the documents higher because the
titles are *shorter* and the word is a bigger precentage of the title,
then that should already be happeing ... i'm suprised by the ordering that
you said you're getting.
what does the debugQuery output look like for those 3 docs?
-Hoss