lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Dates and others
Date Mon, 01 Dec 2003 18:10:42 GMT
Dion Almaer wrote:
> The only real item that I still want to tweak more is getting recent results higher in
the list.
> I was wondering if something like this could work (or if there is a better solution)
> At index time, I have the date of the content.  I could do some math where the higher
the date
> (based on the time_t version or whatever) the more of a setBoost(metric). Or, for every
month in the
> past, create a larger negative number to setBoost()... or something like that.
> Would something like this make sense?

The problem with this approach is that eventually you'll exhaust the 
range of the boost.  So this will only work if you re-index things from 
scratch periodically, with a boost of something like 1/days-ago.

If you're adding documents to the index in date order, then you could 
use a HitCollector which adjusts scores according to the document 
number, since document numbers increase as you add to the index.

If you're not adding things in date order, then you can, when you open 
the index, build an array mapping document numbers to integer dates. 
Then your hit collector can use this to either boost or sort hits by date.

Or you could add a "month" or "week" field to documents, then add it as 
a clause to your queries with a boost.  Then documents matching the most 
recent week(s) and/or month(s) would get the boost.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message