Lucene has a sort function (which by default matters).
Search in sleep mode provides this functionality (FullTextQuery.sort). if you do not want the default behavior, you can pass your own sort object.
Sort sort = new Sort(new SortField("name"));
searchQuery.setSort(sort);
List results = searchQuery.list();
In your case, the default sort should be sufficient.
source
share