I have been trying to make use of the sorting functionality but after many tests I still can't get it to work. Basically, adding the setSort() method or omitting it has no effect and neither does specifying the 'reverse' parameter, when creating a new SortField.
One of my entities has a 'popularity_count' field:
Code:
@Column(name = "popularity_count")
@Field(analyze = Analyze.NO)
public long getPopularityCount() {
return popularityCount;
}
public void setPopularityCount(long popularityCount) {
this.popularityCount = popularityCount;
}
which I want to use to sort by in my query:
Code:
FullTextEntityManager fullTextEntityManager = Search
.getFullTextEntityManager(em);
...
sort = new Sort( new SortField( "popularity_count", SortField.Type.LONG) );
FullTextQuery jpaQuery = fullTextEntityManager.createFullTextQuery(
aggregateQuery, UserMoment.class).setSort(sort);
Unfortunately, this has no effect on the result set, which is always the same.
What could I be doing wrong? Any help is appreciated. I searched the forum for similar questions but nothing I found them seemed to help.