Hi Roy. Using the example schema and data, and copying the "store" field to "store_rpt" indexed with location_rpt field type, try this query:
http://localhost:8983/solr/select?indent=true&fl=name,store&q=*:*&sort=query%28{!geofilt%20score=distance%20filter=false%20sfield=store_rpt%20pt=45.15,-93.85%20d=0%20v=%27%27}%29%20asc sort spec without url encoding: query({!geofilt score=distance filter=false sfield=store_rpt d=0 v=''}) asc One of the tricks there is that it's sorting on the query() function query, which references a query that has its score used as the result of query(). And you put a spatial query in there (note: score=distance only works with rpt), and voila. The fact that v='' is needed appears to be a Solr bug. I realize this is super awkward, so this approach isn't well documented if at all. In Solr 4.5 you can simply use geodist(). Note: if you have only one point per document, I recommend sorting by LatLonType. ~ David roySolr wrote > Hello, > > I use the following distance sorting of SOLR > 4(solr.SpatialRecursivePrefixTreeFieldType): > > fl=*,score&sort=score asc&q={!geofilt score=distance filter=false > sfield=coords pt=54.729696,-98.525391 d=10} > > (from the tutorial on > http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4) > > Now i want to query on a searchstring and still want to sort on distance. > How can i combine this in above solr request? When i add something to the > "q=" it doesn't work. I tried _query_ subquery and other stuff but i don't > get it working > > I appreciate any help, > Thanks ----- Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book -- View this message in context: http://lucene.472066.n3.nabble.com/SOLR4-Spatial-sorting-and-query-string-tp4084318p4084453.html Sent from the Solr - User mailing list archive at Nabble.com.