【发布时间】:2015-03-15 02:00:48
【问题描述】:
早上好,
我要做的是对存储在我的 Cassandra 数据库中并使用 DataStax Enterprise 连接到 Solr 的数据进行空间搜索。
一些信息....我已经创建了数据库并存储了数据。我还已经创建了一个 solr 核心,我可以使用 Solr Admin 查询我的数据库中的数据。
此时,我正在更改我的 schema.xml 以便可以读取我的数据并可以执行空间查询。
我有几个问题,
1) 我应该在 Cassandra 中使用什么变量类型才能让 cassandra 正确读取我的纬度和经度点?
这就是我现在所拥有的——一个示例输入——
-- 我的 latlng(经度纬度点)在 cassandra 中存储为 varchar 变量。
insert into device(id, location) VALUES('test','45.17614,-93.87341');
--运行时仍然得到相同的结果:
"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) 这是我当前的 schema.xml ---- 你觉得它正确吗?
*不确定我是否在正确的地方有dynamicField.....(也在字段部分尝试过)
这是我在 solr admin 中使用的查询......也在终端上尝试过
{!geofilt pt=45.15,-93.85 sfield=location d=5} ---- 在管理员上
SELECT * FROM device WHERE solr_query='{!geofilt sfield=location pt=45.15,-93.85 d=5}' limit 10; ----- 在终端上
我的键空间是这样制作的:
CREATE KEYSPACE 设备 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>
谢谢!
【问题讨论】:
-
我在字段内的字段行下尝试了dynamiceField,也无济于事....
-
您报告的数据没有意义:您创建了一个名为“pois”的表,然后查询了一个名为“mylocation”的表;您的查询结果示例与 schema.xml 不匹配...请发布清晰、一致的数据,然后我们会尽力提供帮助。
-
抱歉,我现在已经编辑了所有信息。
标签: xml solr cassandra schema datastax-enterprise