Hi Hibernators :)
I'm using Hibernate Search 4.1.1.Final.
Since few days, I try to sort my results by date. After many reworks, I think that my sort didn't work because the field is declared in a parent class.
Here is my parent class :
Code:
@MappedSuperclass
public abstract class AbstractDomainEntity implements Serializable {
//...
@Column
@Field(analyze=Analyze.NO) @DateBridge(resolution=Resolution.SECOND)
private Date lastUpdate= new Date();
//...
}
Here is my concrete class :
Code:
@Indexed(interceptor=IndexSoftDeleteInterceptor.class)
public class ConcreteClass extends AbstractDomainEntity {
//...
@Column
@Field(analyze=Analyze.NO) @DateBridge(resolution=Resolution.SECOND)
private Date lastUpdateTest = new Date();
//...
}
Here, the results are
not sorted :
Code:
Sort sort = new Sort(new SortField("lastUpdate", SortField.STRING, REVERTED));
ftQuery.setSort(sort);
Here, the results are sorted :
Code:
Sort sort = new Sort(new SortField("lastUpdateTest", SortField.STRING, REVERTED));
ftQuery.setSort(sort);
How can I sort by
lastUpdate ?