1
votes

Good morning,

What I am trying to do is a spatial search on data which is stored within my Cassandra database and connected to Solr utilizing the DataStax Enterprise.

Some information.... I already have the database created and stored with data.. I have also already created a solr core and I can query data within my database using the Solr Admin.

At this point, I am at the step of altering my schema.xml so that my data can be read and spatial queries can be performed.

I have a few questions,

1) What variable type should I be using within Cassandra in order to be able to have my latitude and longitude points read correctly by cassandra?

This is what I have now -- an example input --

-- my latlng (longitude latitude points) is stored as a varchar variable in cassandra.

insert into device(id, location) VALUES('test','45.17614,-93.87341');

--still getting the same result when running:

"error": {
    "msg": "The field location does not support spatial filtering",
    "trace": "org.apache.solr.common.SolrException: The field location does not support spatial filtering
    "code": 500

}

2) Here is my current schema.xml ---- does it look correct to you?

*Not sure if I have dynamicField in the right place..... (tried in fields section too)

This is the query I'm using in solr admin.... also tried on terminal

{!geofilt pt=45.15,-93.85 sfield=location d=5} ---- on admin

SELECT * FROM device WHERE solr_query='{!geofilt sfield=location pt=45.15,-93.85 d=5}' limit 10; ----- on terminal

My keyspace was made like this:

CREATE KEYSPACE device WITH REPLICATION = {'class':'NetworkTopologyStrategy', 'Solr':1};

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="autoSolrSchema" version="1.5">
    <types>
        <fieldType class="org.apache.solr.schema.StrField" name="StrField"/>
        <fieldType class="solr.LatLonType" subFieldSuffix="_coordinate"     name="coord"/>
    </types>
    <fields>
        <field indexed="true" multiValued="false" name="id" stored="true" type="StrField"/>
        <field indexed="true" multiValued="false" name="location" stored="true" type="coord"/>
        <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
    </fields>
    <uniqueKey>id</uniqueKey>
</schema>

Thanks!

1
I have tried dynamiceField under the field line within fields as well to no avail....robelgado
Your reported data doesn't make sense: you created a table named "pois" and then query a table named "mylocation"; your query result sample doesn't match the schema.xml... please post clear, consistent data and then we'll try to help.sbtourist
I apologize, I have edited all of the information now.robelgado

1 Answers

2
votes
  1. As per the DSE doc, LatLonType maps to Cassandra text or varchar column types.

Check the Solr wiki for some Solr examples: http://wiki.apache.org/solr/SpatialSearch

  1. Your schema looks fine, at a quick glance.

The error message refers to a different field name ("mylocation") than the Solr schema you specified ("location").