You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Gian Marco Tagliani <gm...@aladus.com> on 2006/04/05 17:31:56 UTC
lucene sorting
Hi,
I need to change the lucene sorting to give just a bit more relevance to
the recent documents (but i don't want to sort by date). I'd like to mix
the lucene score with the date of the document.
I'm following the example in "Lucene in Action", chapter 6. I'm trying
to extends the SortComparatorSource but I don't understand how to get
the lucene score of the document.
Do you have some idea about how to solve my problem?
Or do you know where get some more example on custom sorting?
Thanks,
Gian Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: lucene sorting
Posted by Chris Hostetter <ho...@fucit.org>.
I don't know if there is anyway for a Custom Sort to access the lucene
score -- but another approach that works very well is to use the
FunctionQuery classes from Solr...
http://incubator.apache.org/solr/docs/api/org/apache/solr/search/function/package-summary.html
...you can make a FunctionQuery object that scores things linerarly (or
reciprocally, or any other funciton you impliment in java) based on the
value of any field -- and then add that query to a BooleanQuery along with
your orriginal query and use the boost to determine how much of an
influence it has on your final score.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org