Lucene.NET - sorting by int

Posted by Judah Himango on Stack Overflow See other posts from Stack Overflow or by Judah Himango
Published on 2010-04-21T18:21:06Z Indexed on 2010/04/21 18:23 UTC
Read the original article Hit count: 271

Filed under:
|

In the latest version of Lucene (or Lucene.NET), what is the proper way to get the search results back in sorted order?

I have a document like this:

var document = new Lucene.Document();
document.AddField("Text", "foobar");
document.AddField("CreationDate", DateTime.Now.Ticks.ToString()); // store the date as an int

lucene.AddDocument(document);

Now I want do a search and get my results back in order of most recent.

How can I do a search that orders results by CreationDate? All the documentation I see is for old Lucene versions that use now-deprecated APIs.

© Stack Overflow or respective owner

Related posts about lucene

Related posts about lucene.net