DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30678>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30678

sorting by field contents does not work properly

           Summary: sorting by field contents does not work properly
           Product: Lucene
           Version: 1.4
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Search
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I would like to sort my documents by the date of their last modification. Each
document has a field called "last-modified". The values of this field look like
"yyyyMMddHHmm", e.g. "200408081530" for 2004/08/08 15:30.

To the searching process itself, I created a sort object and searched the index

Sort sort = new Sort(new SortField[]{new SortField("last-modified", true)});
Hits hits = searcher.search(query, sort);

But the order of the document is not as expected, e.g. I get

1. 200408170345
2. 200408022206
3. 200407302321
4. 200408030456

I also tried to use

Sort sort = new Sort(new SortField[]{new SortField("last-modified",
SortField.STRING, true)});

but this changed the order to

1. 200408170345
2. 200407302321
3. 200408030456
4. 200408022206

which is again not what I expected.

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

Reply via email to