solr - 如何索引具有 geojson 作为 Solr 中的字段的文档?
问题描述
当我尝试索引具有位置类型字段的文档时,它没有结果。我正在尝试索引文档,然后我希望能够在空间上进行搜索。
我正在关注链接,我也使用 SolrCloud 7.5 版,但我无法正确使用 geojson 属性进行空间搜索。
我的 schema.xml
<fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/>
...
<field name="id" type="string" multiValued="false" indexed="true" required="true" stored="true"/>
<field name="geo_location" type="location" stored="true"/>
<field name="otherProperty" type="string" stored="true"/>
该文档包含一个 geojson 和任何属性字段
当我尝试使用 rest api 索引此文档时
{
"id":"12345",
"location_try": {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
125.6,
10.1
]
},
"properties": {
"name": "Dinagat Islands"
}
},
"otherProperty":"something"
}
索引操作完成后,托管架构更改为
...
<field name="location_try" type="location" stored="true"/>
<field name="location_try.geometry.coordinates" type="pdoubles"/>
<field name="location_try.geometry.type" type="text_general"/>
<field name="location_try.properties.name" type="text_general"/>
<field name="location_try.type" type="text_general"/>
我可以在集合中看到我的文档,但我无法从查询中获得响应
http://localhost:8983/solr/geoCollection/select?&q=*:*&fq={!geofilt sfield=location_try}&pt=10.11,11.11&d=1
如何正确索引 geojson 并在 solr 中使用空间字段进行搜索?例如,我想在边界框或多边形内获取文档?
解决方案
推荐阅读
- jenkins - 检查 gradle 子项目是否存在 - 来自 Jenkins 管道
- python - % 在模块旁边有什么作用,比如 %matplotlib 小部件
- sql - 在 SQL 中为一个元素只选择 n 行
- python - python dataframe:显示一系列事件
- avro - 具有默认对象数组的 AVRO 模式
- python - 连接数据框中的两行
- python - Python 类:避免在函数中多次使用“self”参数
- java - 将 jsonb 数据从 Java 保存到 Postgres
- phpunit - 在 Laravel 中重现随机测试(使用 Faker)
- c# - 对 C# 后端的 MVC 请求中可变数量的输入(来自 db)?