6 messages in org.apache.lucene.java-userRe: Reverse sorting by index order
FromSent OnAttachments
Oren Shir03 Nov 2005 06:37 
Andy Lee03 Nov 2005 06:55 
Oren Shir03 Nov 2005 07:22 
Andy Lee03 Nov 2005 07:26 
Oren Shir03 Nov 2005 07:57 
Oren Shir03 Nov 2005 08:30 
Subject:Re: Reverse sorting by index order
From:Andy Lee (agl@earthlink.net)
Date:11/03/2005 06:55:37 AM
List:org.apache.lucene.java-user

On Nov 3, 2005, at 9:37 AM, Oren Shir wrote:

If I understand correctly, when sorting by Sort.INDEXORDER the oldest documents that were added to the index will be returned first. I want the reverse, because I'm more interested in newer documents.

Looking at the source, I see that Sort.INDEXORDER is simply an instance of Sort:

public static final Sort INDEXORDER = new Sort(SortField.FIELD_DOC);

Haven't tried this myself, but you could create your own instance that uses a reverse sort:

Sort reverseIndexOrder = new Sort(SortField.FIELD_DOC, true);

And use that wherever you were using Sort.INDEXORDER.

--Andy