Ciao, I'm unable to get the following solr query working with Spring Solr Data.
q=name:rsa&sfield=coordinates&pt=-8.506854,115.262478&sort=geodist()%20asc
The query works if I put it inside solr admin console, but it doesn't work with spring solr data. I didn't find examples about geodist sorting inside documentation so I created a CustomRepository with the following function:
public Page<StructureDocument> findStructuresByNameAndCoordinates(String value, Point point, Pageable page) {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("name:*").append(value).append("*");
queryBuilder.append("&sfield=coordinates");
queryBuilder.append("&pt=").append(point.getX()).append(",").append(point.getY());
queryBuilder.append("&sort=geodist() asc");
Query query = new SimpleQuery(new SimpleStringCriteria(queryBuilder.toString())).setPageRequest(page);
But it doesn't work because of syntax error (seems that Solrj doesn't like this chars (). This is the error:
; nested exception is org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr: org.apache.solr.search.SyntaxError: Cannot parse 'name:*francesco*&sfield=coordinates&pt=-8.506854,115.262478&sort=geodist() asc': Encountered " ")" ") "" at line 1, column 71.
How can I sort by geodist function with spring solr data??
Thank you very much.