BTW, for future reference, this question is better suited to the java- user list...

There are actually various ways to do this.  First question is how to
store the info... you can use payloads (as Shai describes), or a
simple stored field, or single-term index & load through FieldCache.

Second question is how to impact the scoring... you can make your own
HitCollector and change the score during collect(), you can create a
new Query class (as Chris describes) that with a custom scorer, if you
used payloads as storage you can use the existing BoostingTermQuery
and provide a Similarity whose scorePayload method takes the date into
account.  Or you can use a FunctionQuery to customize the scoring.

The upcoming Lucene in Action revision (now available online through
Manning's MEAP) has a basic example of this (boosting by recency) in
the Advanced Search chapter, using function queries.

Mike

Chris Lu wrote:

No default behavior of Lucene does this.

My approach is to create a time weight query with a scorer that weighs in the time based on a user-defined formula. This way, you can view the explained query with the time weighting information, and the weighting can be dynamically controlled.

This is a built-in feature of DBSight and works well in real production sites. I am not sure how payload can help. If payload is used to store date, it seems redundant since you can easily store date field in the document, and you can get the date from the field cache pretty quickly.

--
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes: 
http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes
DBSight customer, a shopping comparison site, (anonymous per request) got 2.6 Million Euro funding!

On Wed, Jan 14, 2009 at 7:44 PM, mitu2009 <musicfrea...@gmail.com> wrote:

Hi,

Is it possible to bubble up newer records in lucene search results? ie.I want Lucene to give a higher score to records which are closer to today's
date.
--
View this message in context: 
http://www.nabble.com/Bubbling-up-newer-records-tp21470766p21470766.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to