lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aakanksha Gupta <aakankshagupta2...@gmail.com>
Subject Getting the error - The field '*********' does not support spatial filtering
Date Sun, 18 Feb 2018 13:27:28 GMT
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?

Mime
View raw message