We recently upgraded from Neo4j 1.9 to 2.1 and are now receiving an error when an existing object is updated with a spatial index.
We are using the following:
Spring Data NEO4J 3.1 Neo4j 2.1.2 server with the spatial plugin
I have narrowed the problem down to a REST call of the following:
http://localhost:7474/db/data/index/node/<index name>
JSON Post:
{
"value" : "POINT(-87.626451 41.870515)",
"uri" : "http://localhost:7474/db/data/node/113",
"key" : "wkt"
}
I am getting the following response:
{
"message" : "GeometryNode not indexed in this RTree: 114",
"exception" : "RuntimeException",
"fullname" : "java.lang.RuntimeException",
"stacktrace" : [ "org.neo4j.gis.spatial.rtree.RTreeIndex.findLeafContainingGeometryNode(RTreeIndex.java:812)", "org.neo4j.gis.spatial.rtree.RTreeIndex.remove(RTreeIndex.java:111)", "org.neo4j.gis.spatial.rtree.RTreeIndex.remove(RTreeIndex.java:100)", "org.neo4j.gis.spatial.EditableLayerImpl.update(EditableLayerImpl.java:56)", "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:143)", "org.neo4j.gis.spatial.indexprovider.LayerNodeIndex.add(LayerNodeIndex.java:41)", "org.neo4j.server.rest.web.DatabaseActions.addToNodeIndex(DatabaseActions.java:686)", "org.neo4j.server.rest.web.RestfulGraphDatabase.addToNodeIndex(RestfulGraphDatabase.java:1022)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "java.lang.Thread.run(Unknown Source)" ]
}
EDIT
After doing some additional research I found that the error is being thrown because the root node of the geometry relationship (952) does not equal the root node of the index root (2308).
Here are the relationships and node properties for the associated geometry node and the index root:
114<-[RTREE_REFERENCE]-6<-[RTREE_CHILD]-952<-[RTREE_CHILD]-(null)
114
id 113
bbox [-87.626451,41.870515,-87.626451,41.870515]
wkt POINT (-87.626451 41.870515)
gtype 1
6
bbox [-88.459688,41.711991,-86.856991,42.153793]
952
bbox [-118.823745,0,0,44.591593]
2307-[RTREE_ROOT]->[2308]
2307
layer_class org.neo4j.gis.spatial.EditableLayerImpl
layer dib_location
geomencoder org.neo4j.gis.spatial.WKTGeometryEncoder
geomencoder_config wkt
ctime 1404877913340
2308
layer_class org.neo4j.gis.spatial.EditableLayerImpl
layer dib_location
geomencoder org.neo4j.gis.spatial.WKTGeometryEncoder
geomencoder_config wkt
ctime 1404877913340