Thanks David. That was helpful. I was able to get it to work with after I removed my schema.xml and modified the managed-schema to add my fields. I'm not sure if this is the right thing to do, but this is how I got it to work :)
On Mon, Feb 19, 2018 at 7:54 AM, Howe, David <david.h...@auspost.com.au> wrote: > Hi Aakanksha, > > > > We use the following for geo queries which works for us: > > > > /solr/core/select?defType=edismax&indent=on&ps=0&start= > 0&wt=json&sow=true&hl=on&hl.fl=*&fq=%7B!geofilt%7D&pt=-6. > 08165,145.8612430&d=10&sfield=geoLocation&sort=geodist()% > 20asc&rows=10&fl=*,score,distance:geodist() > > > > This gives us the results closest to the provided point in order of their > distance from the point. > > > > Our field definition is: > > > > echo "$(date) Creating geoLocation field" > > curl -X POST -H 'Content-type:application/json' --data-binary '{ > > "add-field":{ > > "name":"geoLocation", > > "type":"location", > > "stored":true, > > "indexed":true > > } > > }' http://localhost:8983/solr/core/schema > > > > We are running Solr 7.1.0. > > > > Hope this helps. > > > > Regards, > > > > David > > > > > > *From:* Aakanksha Gupta [mailto:aakankshagupta2...@gmail.com] > *Sent:* Monday, 19 February 2018 12:27 AM > *To:* solr-user@lucene.apache.org > *Subject:* Getting the error - The field '*********' does not support > spatial filtering > > > > Hi all, > > I'm a newbie to Solr. I'm trying to use it for GeoSpatial Search and I'm > facing an issue while using it. I've tried using the new 'location' field > type(<fieldType name="location" class="solr.LatLonPointSpatialField" > docValues="true"/>) as well as the deprecated solr.LatLonType fieldtype, > but I always get the error: > > > org.apache.solr.common.SolrException: The field latlong does not support > spatial filtering > > Here's a snippet of my field definition in schema.xml in the conf folder > of my core: > > <field name="id" type="string" indexed="true" stored="true" > required="true" multiValued="false" /> > <!-- docValues are enabled by default for long type so we don't need > to index the version field --> > <field name="_version_" type="plong" indexed="false" stored="false"/> > <field name="_root_" type="string" indexed="true" stored="false" > docValues="false" /> > <field name="_text_" type="text_general" indexed="true" stored="false" > multiValued="true"/> > <field name="driverid" type="pint" indexed="true" stored="true" /> > <field name="latlong" type="location" indexed="true" stored="true" /> > <field name="time" type="string" indexed="false" stored="true" /> > <field name="timestamp" type="plong" indexed="true" stored="true" /> > <field name="latlong2" type="loc" indexed="true" stored="true" /> > <field name="location_0_coordinate" type="double" indexed="true" > stored="true" /> > <field name="location_1_coordinate" type="double" indexed="true" > stored="true" /> > > And here are the field type definitions: > <fieldType name="loc" class="solr.LatLonType" > subFieldSuffix="_coordinate"/> > <fieldType name="location" class="solr.LatLonPointSpatialField" > docValues="true"/> > > Here's the Query I'm running: > http://localhost:8983/solr/geo2/select?wt=json&q=:&fq={!geofilt > sfield=latlong}&pt=-6.08165,145.8612430&d=100 > > http://localhost:8983/solr/geo2/select/?q=*:*&fq={! > geofilt}&sfield=latlong2&pt=-6.08165,145.8612430&d=100&wt=json > > And here's the Java snippet I'm using to insert data: > String urlString = "http://localhost:8983/solr/geo2"; > SolrClient solr = new HttpSolrClient.Builder(urlString).build(); > SolrInputDocument document = new SolrInputDocument(); > document.addField("id", UUID.randomUUID().toString()); > document.addField("driverid", "1"); > document.addField("latlong", "-6.081689,145.391881"); > document.addField("time", "7:01:17"); > document.addField("timestamp", Long.valueOf("1518908477190")); > document.addField("latlong2", "-6.081689,145.391881"); > document.addField("location_0_coordinate", > Double.valueOf(-6.081689)); > document.addField("location_1_coordinate", > Double.valueOf(145.391881)); > UpdateResponse response = solr.add(document); > solr.commit(); > response.getQTime(); > > > > I've attached my schema.xml file herewith. Can someone let me know what > I'm doing wrong? > > > > David Howe > Java Domain Architect > Postal Systems > Australia Post > > Level 16, 111 Bourke Street > <https://maps.google.com/?q=Level+16,+111+Bourke+Street%0D+Melbourne%0D+VIC%0D+3000&entry=gmail&source=g> > Melbourne > <https://maps.google.com/?q=Level+16,+111+Bourke+Street%0D+Melbourne%0D+VIC%0D+3000&entry=gmail&source=g> > VIC > <https://maps.google.com/?q=Level+16,+111+Bourke+Street%0D+Melbourne%0D+VIC%0D+3000&entry=gmail&source=g> > 3000 > <https://maps.google.com/?q=Level+16,+111+Bourke+Street%0D+Melbourne%0D+VIC%0D+3000&entry=gmail&source=g> > > T 0391067904 > > M 0424036591 > > E david.h...@auspost.com.au > [image: Australia Post website] <https://auspost.com.au> > [image: StarTrack website] <https://startrack.com.au/> > [image: Follow us on Twitter] <https://twitter.com/auspost> [image: Like > us on Facebook] <https://www.facebook.com/australiapost> [image: Connect > with us on LinkedIn] <https://www.linkedin.com/company/australia-post> > > Australia Post is committed to providing our customers with excellent > service. If we can assist you in any way please telephone 13 13 18 or visit > our website. > > The information contained in this email communication may be proprietary, > confidential or legally professionally privileged. It is intended > exclusively for the individual or entity to which it is addressed. You > should only read, disclose, re-transmit, copy, distribute, act in reliance > on or commercialise the information if you are authorised to do so. > Australia Post does not represent, warrant or guarantee that the integrity > of this email communication has been maintained nor that the communication > is free of errors, virus or interference. > > If you are not the addressee or intended recipient please notify us by > replying direct to the sender and then destroy any electronic or paper copy > of this message. Any views expressed in this email communication are taken > to be those of the individual sender, except where the sender specifically > attributes those views to Australia Post and is authorised to do so. > > Please consider the environment before printing this email. >