lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Sorting results
Date Wed, 07 May 2008 04:56:06 GMT

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


View raw message