Hi,

 

I need to sort my search results by descending publication date.

 

To do this, I added a field like this in all documents 

 

doc.add(new Field("pubdate", date, Field.Store.YES,
Field.Index.UN_TOKENIZED));

 

Where date contains string formatted in this way “yyyymmddhhmmss “

 

Searches are executed like this 

 

hits = searcher.search(booleanQuery, new Sort("pubdate", true));

 

Here is a example of result output for the date field. We can see that the
result is not sorted neither ascending, neither descending.

 

20080114190000

20080114225500

20080114232900

20080114235700

20080115102800

20080115100600

20080115124639

20080115124100

20080115131700

20080115131900

20080112000100

20080112001700

20080112001900

20080112074400

20080112080000

20080112082000

 

 

What can be the problem ? Where am I wrong ?

 

Thank you by advance.

 

dominique

Reply via email to