lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: To Sort or not to Sort
Date Fri, 17 Dec 2004 01:31:26 GMT
: In my application, users search for messages with Lucene.  Typically,
: they are more interested in seeing their hits in date-order than in
: relevance-order.  In reading my ebook copy of "Lucene in action" (wish
: I'd had that a year ago), I find that one of the features added in 1.4
: was the ability to ask for hits in an order based on a field.  It also
: looks like adding the field necessary to get things by date order is
: straight forward.

When considering issues like this, it's important to consider what is
really important to your users: Do they eally want to see items strictly
ordered by date, or do they want to see results sorted by relevancy --
where the "recentness" of an item influences how "relevent" it is.

For example, when I search theLucene users mailing list for "RangeQuery" I
want more recent messages to appear first, but I'd still prefer that a
slightly older message "bubble up" in the list if the Subject includes
"RangeQuery" and the body mentions RangeQuery dozens of times -- because
it's likely to be very relevent then more recent messages which only
mention RangeQuery once or twice -- but I don't want results that are
strictly sorted by term frequency, becuase then messages from 3 years ago
(and several Lucene revs ago) might be at the top of the list.

Depending on how you maintain your index, there are a couple of different
ways of achieving a goal like this.  if you rebuild regularly, then just
giving your more recent documents a higher boost is one way to go.
another would be to use several FilteredQuery(RangeFilter) with several
increasing intervals of dates (ie: today OR the past week OR the past
month OR the past year) so that more recent documents match all of the
clauses, and older documents match fewer (or none)


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

View raw message