We want to add custom order by to hibernate full text search,suppose we want to search the record based on location, if the location is "country,state,city
Then we want to have the search with records in the top which are near to user
We followed following links.
using mysql "order by case" in hibernate criteria
But the order by clause is not getting added when we add it to criteria object
Sort is working only when we set to full Text Query object like below, here we can do only asc and desc, dynamic order by not.
Sort sort = new Sort( new SortField( "location", SortField.Type.STRING, false ) );
fullTextQuery.setSort( sort );
It is geo location based search.
we are storing the location value in mysql table column as "India,Karnataka,Bangalore" suppose user from Bangalore logins we need to show the records which are from Bangalore first at the top.
It would be helpful if we get some information regarding this, or any other way to achieve this problem.
Thanks, Mohsin