Lucene does not currently support sorting by fields (such as a date field).

This is one of the to do items.  I have implemented a sort by date on top of
Lucene (not built into Lucene's core), and plan to add it to the
contributions section once I get it a little more documented.

The method I used was suggested by Doug and is to create an array at startup
with contents of the field you want to sort by (in my case a date field).
For my list of 100,000 docs, this takes about 3 seconds. Then after you get
back the results from the search, look up the Lucene unique doc Ids (you'll
have to change the Hits interface to make this ID accessible) in the array,
get the field value and sort it. For my search results of about 15000, it
adds about .04 seconds to the search. It does get slower with more results.
Note that this is could be optimized with a TopDocs like implementation to
only sort the items that are near the top.

--Peter

On 4/30/02 11:38 AM, "Joel Bernstein" <[EMAIL PROTECTED]> wrote:

> The DateFilter interface seems only to filter (include/exlcude) the results
> by date.
> Does it also sort the results by date?
> 
> Thanks


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to