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 stlecho <st...@gmail.com> on 2008/05/26 13:21:39 UTC
Date Range Query: How to get a higher score for dates close to a
reference date ?
Hi,
In the application I'm developing I'm able to query on 2 properties of my
model: Name and BirthDay. Records that have an exact match on the name
property and for which the birthday is close to the specified BirthDay query
parameter should have a higher score.
Does Lucene support the following scenario ? The user specifies a
ReferenceDate with a Tolerance. The ReferenceDate and Tolerance are used to
query the index and get the hits. The score of the hits should be based on
the "distance" between the ReferenceDate and the BirthDay of the hit. In
other words: BirthDays that are in the specified range, but closer to the
ReferenceDate should have a higher score.
Example:
The user wants to search persons born on 2003-05-01, but with a tolerance of
5 years (because the user is no sure about the exact birthyear)
-Reference Date: 2003-05-01
-Range Query: [1998-05-01 TO 2008-05-01]
-Results with birthday 1998-05-01 should have a lower score than results
with birthday 2003-01-01 (because this date is closer to the reference date
2003-05-01)
Regards, Stefan Lecho.
--
View this message in context: http://www.nabble.com/Date-Range-Query%3A-How-to-get-a-higher-score-for-dates-close-to-a-reference-date---tp17470154p17470154.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Date Range Query: How to get a higher score for dates close to
a reference date ?
Posted by Chris Hostetter <ho...@fucit.org>.
: In the application I'm developing I'm able to query on 2 properties of my
: model: Name and BirthDay. Records that have an exact match on the name
: property and for which the birthday is close to the specified BirthDay query
: parameter should have a higher score.
use a RangeFilter to constrain your results to therange you want, then use
a ValueSourceQuery to score documents higher when the value of the
BirthDay field is "nearer" your target date.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org