You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by bu...@apache.org on 2004/08/15 16:41:56 UTC

DO NOT REPLY [Bug 30678] New: - sorting by field contents does not work properly

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: lucene-dev@jakarta.apache.org
        ReportedBy: tilman.giese@gmx.de


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: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org