lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Williams <william...@gmail.com>
Subject Re: How to customize score according to field value?
Date Tue, 07 Apr 2009 13:01:18 GMT
On Tue, Apr 7, 2009 at 3:08 AM, Jinming Zhang <spee.zhang@gmail.com> wrote:
> Hi,
>
> I have the following situation which needs to customize the final score
> according to field value.
>
> Suppose there are two docs in my query result, and they are ordered by
> default score sort:
>
> doc1(field1:bookA, field2:2000-01-01) -- score:0.80
> doc2(field1:bookB, filed2:2009-01-01) -- score:0.70
>
> I want "doc2" to have a higher score since it's publishing date is more
> recent, while "doc1" to have a lower score:
>
> doc2(field1:bookB, filed2:2009-01-01) -- score:0.77
> doc1(field1:bookA, field2:2000-01-01) -- score:0.73
>
> I found this scenario is different from doc.setBoost() and field.setBoost().
> Is there any way to impact the score calculated for "doc1" & "doc2"
> according to the value of "field2"?
>
> Thank you in advance!

If you have access to the MEAP for Lucine In Action 2nd Edition, it
demonstrates using a CustomScoreQuery[1] for to boost a docs score
based on recency.

--tim

[1] - http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/search/function/CustomScoreQuery.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message