Solr的地理空间格式化器不起作用?

FGr*_*reg 6 lucene solr geospatial

我已将包含SpatialRecursivePrefixTreeFieldType名为"geo" 的字段的文档编入索引.我正在阅读有关地理空间格式化程序的内容,并希望尝试它,但我似乎无法让它工作.

这是我索引的示例文档:

{
    "geo": "POLYGON((22.376144 -50.055954, 36.013237 -50.055954, 36.013237 -47.949005, 22.376144 -47.949005, 22.376144 -50.055954))",
    "id": "a3ca6c69-acb9-30e6-b1a6-dbfd72917bc8",
    "val_d": 33.067356,
    "_version_": 1541776337602084900,
    "insert_timestamp": "2016-08-04T23:14:54.814Z"
}
Run Code Online (Sandbox Code Playgroud)

这是我正在尝试的查询:

q=id%3A%22a3ca6c69-acb9-30e6-b1a6-dbfd72917bc8%22&rows=1&fl=*%2C%5Bgeo+f%3Dgeo+w%3DGeoJSON%5D&wt=json&indent=true
Run Code Online (Sandbox Code Playgroud)

以更易读的格式:

q=id:"a3ca6c69-acb9-30e6-b1a6-dbfd72917bc8"
rows=1
fl=*,[geo f=geo w=GeoJSON]
wt=json
indent=true
Run Code Online (Sandbox Code Playgroud)

我得到的结果就是我上面引用的索引文档.我也尝试修改fl参数以包含这样的键,fl=*,geojson[geo f=geo w=GeoJSON]但这也不起作用.

有没有理由我无法让格式化器工作?

版本信息:

  • solr-spec:5.3.1
  • solr-impl:5.3.1 1703449 - 贵族 - 2015-09-17 01:48:15
  • lucene-spec:5.3.1
  • lucene-impl:5.3.1 1703449 - 贵族 - 2015-09-17 01:38:09

FGr*_*reg 2

根据以下内容,在版本 6.1 中添加了地理空间转换器:

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

FeatureCollection通过细微的更改,我们可以修改现有的 JSON 编写器来为 SolrDocumentList生成 GeoJSON 。然后,我们可以选择一个字段用作几何类型,并将其用于 Feature#geometry
"response":{"type":"FeatureCollection","numFound":1,"start":0,"features":[ {"type":"Feature", "geometry":{"type":"Point","coordinates":[1,2]}, "properties":{ ... the normal solr doc fields here ...}}] }}
这将允许将 solr 结果直接添加到各种映射客户端,如 Leaflet 此补丁将适用于具有空间字段的文档: 1.扩展 AbstractSpatialFieldType 2. 具有 geojson 的存储值 2. 具有可以由 Spatial4j (WKT 等) 解析的存储值 空间字段通过参数进行标识geojson.field

它被标记为

修复版本:6.1,主版(7.0)

所以问题的答案是;地理空间格式化程序需要升级到 Solr 6.1 才能工作。