Neo4j Spatial 3.0.2:找不到索引提供程序 'spatial'

Neo4j Spatial 3.0.2: No index provider 'spatial' found

我正在尝试使用 neo4j 3.0.2 和 neo4j-spatial for 3.0.2 创建一个空间数据库。我已经安装了插件,我已经检查过插件是 运行 cURL curl -v http://neo4j:neo4j@localhost:7474/db/data/ 输出如下:

{
  "extensions" : {
    "SpatialPlugin" : {
      "addSimplePointLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer",
      "addNodesToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodesToLayer",
      "findClosestGeometries" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findClosestGeometries",
      "addGeometryWKTToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer",
      "findGeometriesWithinDistance" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance",
      "addEditableLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addEditableLayer",
      "addCQLDynamicLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addCQLDynamicLayer",
      "addNodeToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer",
      "getLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/getLayer",
      "findGeometriesInBBox" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInBBox",
      "updateGeometryFromWKT" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/updateGeometryFromWKT",
      "findGeometriesIntersectingBBox" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesIntersectingBBox"
    }
  },
  "node" : "http://localhost:7474/db/data/node",
  "relationship" : "http://localhost:7474/db/data/relationship",
  "node_index" : "http://localhost:7474/db/data/index/node",
  "relationship_index" : "http://localhost:7474/db/data/index/relationship",
  "extensions_info" : "http://localhost:7474/db/data/ext",
  "relationship_types" : "http://localhost:7474/db/data/relationship/types",
  "batch" : "http://localhost:7474/db/data/batch",
  "cypher" : "http://localhost:7474/db/data/cypher",
  "indexes" : "http://localhost:7474/db/data/schema/index",
  "constraints" : "http://localhost:7474/db/data/schema/constraint",
  "transaction" : "http://localhost:7474/db/data/transaction",
  "node_labels" : "http://localhost:7474/db/data/labels",
  "neo4j_version" : "3.0.2"
* Connection #0 to host localhost left intact
}* Closing connection #0

现在我可以创建一个新的 simplePointLayer:

// define entity manager
$client = $this->get('neo4j.spatial_manager')->getClient();



// 1. Create a pointlayer
$request = $client->request('POST',
    '/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer',
    [
        'json' => [
            'layer' => 'geom',
            'lat' => 'lat',
            'lon' => 'lon',
        ],
    ]
);

var_dump($request);

这将使用 rTree 创建空间根节点。但是当我现在想创建一个空间索引时:

// 2. Create a spatial index
$request = $client->request('POST',
    '/db/data/index/node/',
    [
        'json' => [
            'name' => 'geom',
            'config' => [
                'provider' => 'spatial',
                'geometry_type' => 'point',
                'lat' => 'lat',
                'lon' => 'lon',
            ],
        ],
    ]
);

var_dump($request);

我遇到错误消息:

"message" : "No index provider 'spatial' found. 

我做错了什么?我已经检查了很多论坛等等,但答案似乎总是安装我拥有的空间插件,它似乎根据第一个输出工作。

编辑 2016 年 6 月 15 日

奇怪的是我可以向 rTree 添加节点:

   // Create a node with spatial data
    $json = [
        'team' => 'REDBLUE',
        'name' => 'TEST',
        'lat' => 25.121075,
        'lon' => 89.990630,
    ];
    $response = $client->request('POST',
        '/db/data/node', 
        [
            'json' => $json
        ]
    );

    $node = json_decode($response->getBody(), true)['self'];

   // Add the node to the layer
   $response = $client->request('POST',
        '/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer',
        [
            'json' => [
                'layer' => 'geom',
                'node' => $node,
            ],
        ]
    );

    $data = json_decode($response->getBody(), true);

    var_dump($data);

而且我可以通过 REST 查询节点:

    $request = $client->request('POST',
        '/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance',
        [
            'json' => [
                'layer' => 'geom',
                'pointX' => 89.99506,
                'pointY' => 25.121260,
                'distanceInKm' => 10,
            ],
        ]
    );

$data = json_decode($request->getBody(), true);

var_dump($data);

但为什么不让我创建索引?还是它会自动进行索引?如果是这样,我如何使用 CYPHER 进行查询(例如在 Web 控制台中)?

如有任何帮助,我们将不胜感激!干杯

删除了索引提供程序(当时它是提供与 Cypher 集成的唯一方法),以支持 Spatial 的用户定义过程。

参见:https://github.com/neo4j-contrib/spatial/blob/master/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java#L113

由于这是一个新的主要版本(针对 3.0),我们发现删除索引提供程序是明智的。