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!