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

Solr's Geospatial Formatter doesn't work?

我已经为包含名为 'geo' 的 SpatialRecursivePrefixTreeFieldType 字段的文档建立了索引。我正在阅读有关 Geospatial formatter 的信息并想尝试一下,但我似乎无法让它工作。

这是我已编入索引的示例文档:

{
    "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"
}

这是我正在尝试的查询:

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

采用更易读的格式:

q=id:"a3ca6c69-acb9-30e6-b1a6-dbfd72917bc8"
rows=1
fl=*,[geo f=geo w=GeoJSON]
wt=json
indent=true

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

我无法让格式化程序工作的原因是什么?

版本信息:

地理空间变换器是在 6.1 版中根据以下内容添加的:

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

With minor changes, we can modify the existing JSON writer to produce a GeoJSON FeatureCollection for ever SolrDocumentList. We can then pick a field to use as the geometry type, and use that for the 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 ...}}] }}
This will allow adding solr results directly to various mapping clients like Leaflet This patch will work with Documents that have a spatial field the either: 1. Extends AbstractSpatialFieldType 2. has a stored value with geojson 2. has a stored value that can be parsed by spatial4j (WKT, etc) The spatial field is identified with the parameter geojson.field

标记为

Fix Version/s: 6.1, master (7.0)

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