I have a snippet that gets results of a search from hibernate search using apache lucene. When I enter a search parameter for instance "college", the results of words starting with college appears at number way bellow of the search results. Considering the result I decided to sort the result set and below is my approach but its not working as expected
org.apache.lucene.search.Query luceneQuery = qb.keyword().fuzzy().withThreshold(.8f)
.withPrefixLength(1).onFields("fieldName").boostedTo(3)
.matching(searchTerm).createQuery();
// org.hibernate.search.FullTextQuery query = s.createFullTextQuery( luceneQuery, MyEntity.class );
// org.apache.lucene.search.Sort sort = new Sort(
// SortField.FIELD_SCORE,
// new SortField("id", SortField.STRING, true));
// luceneQuery.setSort(sort);
// List results = query.list();
From the above snippet, I have to comment out the sorting algorithm I am implementing because of error lines