solr

时间:2017-07-17 06:38:08

标签: solr lucene spatial kdtree spatial-index

Lucene在6.0中添加multi dimensional point support

https://issues.apache.org/jira/browse/LUCENE-7494

我怎样才能在Solr中使用它?我希望有一个简单的端到端示例"这将是一篇有价值的博客文章。

1)在架构中定义

curl -XPOST -H 'Content-type:application/json' --data-binary '{
  "add-field-type" : {
    "name":"mypoint",
    "class":"solr.DoublePointField" //is this right? 
}}' http://localhost:8983/solr/mycore/schema

curl -XPOST -H 'Content-type:application/json' --data-binary '{
  "add-field":{
    "name":"coords",
    "type":"mypoint",
    "stored":true,
    "indexed":true
  }
}' http://localhost:8983/solr/mycore/schema

2)发布数据

curl -X POST -H 'Content-Type: application/json' --data-binary '{
  "id": "1",
  "coords": "1.5 -0.2222 14213 here I can use my n-dimensional point?",
}' http://localhost:8983/solr/mycore/update/json/docs

3)进行点距离或距离查询

???  I don't know how to do this.

更新:我最终使用了postgresql,它通过cube插件支持k-d树欧氏距离搜索。

1 个答案:

答案 0 :(得分:1)

截至撰写本文时,尚未实施。底层的Lucene层有它。

https://issues.apache.org/jira/browse/SOLR-11077