On 01/14/2009 at 10:44 PM, mitu2009 wrote: > 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.
In addition to the fine ideas given by previous posters, Andrzej Bialecki has described a technique that uses term frequency alone to affect the score: from <http://www.gossamer-threads.com/lists/lucene/java-user/43457>: > Here's the trick that works for me, without the issues of boost > resolution or FunctionQuery. > > Add a separate field, say "days", in which you will put as many "1" as > many days elapsed since the epoch (not neccessarily since 1 Jan 1970 - > pick a date that makes sense for you). Then, if you want to prioritize > newer documents, just add "+days:1" to your query. Voila - the final > results are a sum of other score factors plus a score factor that is > higher for more recent document, containing more 1-s. > > If you are dealing with large time spans, you can split this into years > and days-in-a-year, and apply query boosts, like "+years:1^10.0 > +days:1^0.02". Do some experiments and find what works best for you. As noted in a later thread discussing this issue <http://www.gossamer-threads.com/lists/lucene/java-user/64482>, you should turn norms off on the "days" field: <http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/document/Fieldable.html#setOmitNorms(boolean)> Steve --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org