lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: How to customize score according to field value?
Date Tue, 07 Apr 2009 12:48:04 GMT
Do you want the dates to *influence* or *determine* the order? I
don't have much help if what you're after is something like "docs
that are more recent tend to rank higher", although I vaguely
remember this question coming up on the user list, maybe a
search of the archive would turn something helpful up...

But if you want the date to completely determine order you can
always sort by date, see some of the IndexSearcher.search(...sort...)
methods.


Best
Erick


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!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message