solr中的多维点
multi dimensional points in solr
Lucene 在 6.0
中添加了 multi dimensional point support
https://issues.apache.org/jira/browse/LUCENE-7494
如何在 Solr 中使用它?我希望 "simple end to end example" 这将是一个有价值的博客 post。
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) post 数据
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 树欧氏距离搜索。
截至撰写本文时,尚未实施。底层Lucene层有它。
Lucene 在 6.0
中添加了 multi dimensional point supporthttps://issues.apache.org/jira/browse/LUCENE-7494
如何在 Solr 中使用它?我希望 "simple end to end example" 这将是一个有价值的博客 post。
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) post 数据
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 树欧氏距离搜索。
截至撰写本文时,尚未实施。底层Lucene层有它。