Problem with date Sort

Description

I have a problem when I made a date Sort.

The main method is in HibernateUtil.java

I inserted 2 objects "Entite". Then, I made a search and sort is :

fullTextQuery.setSort(new Sort("date",false));
Result :
Date : Tue Jul 17 10:48:26 CEST 2007
Date : Tue Jul 17 10:48:29 CEST 2007

and
fullTextQuery.setSort(new Sort("date",true));
Result :
Date : Tue Jul 17 10:49:04 CEST 2007
Date : Tue Jul 17 10:49:08 CEST 2007

The results are in the same order :S

Is it an HSearch bug ?

Thank you.

Attachments

1

Activity

Show:

Emmanuel Bernard July 26, 2007 at 7:56 PM

nope, report it to the Lucene guys, but I think they might reject it. the AUTO discovery mode is not fully reliable

Fabien Michon July 26, 2007 at 5:22 PM

Yeah ! Thank you very much Emmanuel ! It was a bug .

Do you know if in a future release of Lucene the bug will desapear ?

Emmanuel Bernard July 26, 2007 at 3:17 PM

This is a bug/flaw in the Lucene Sort type detector, set it up manually
new Sort( new SortField( "date", SortField.STRING, true ) );

Really you should start learning how to use a debugger: both Hibernate Search and Apache Lucene are open source, that makes it easy.

Fabien Michon July 26, 2007 at 11:24 AM

Sorry, I forgot to change it.

If you write this :
@Field(index=Index.UN_TOKENIZED, store=Store.YES)
@DateBridge(resolution=Resolution.SECOND)
private Date date;

and fullTextQuery.setSort(new Sort("date",true));

the result is not reversed :
Date : Thu Jul 26 11:21:30 CEST 2007
Date : Thu Jul 26 11:21:33 CEST 2007

My test is in main method of com.test.dao.utilitaires.HibernateUtil

Emmanuel Bernard July 25, 2007 at 10:40 PM

I could not find the failing test case in your code.
But at least somehting is wrong as I told you on the forum, you must not use TOKENIZED fields when sorting.

Anyway, I updated the test in org.hibernate.search.test.query.LuceneSortTest and sorting works as expected.

Cannot Reproduce

Details

Assignee

Reporter

Priority

Created July 17, 2007 at 10:52 AM
Updated July 1, 2010 at 12:41 PM
Resolved July 25, 2007 at 10:40 PM