1
votes

Quite simply, this question or answer does not exist anywhere I have looked.

The objective is to reindex a node to update it's latitude and longitude properties.

The plugin I'm using to accomplish Geospatial operations in neo4j is called Spatial


Here is my setup

I create a pointlayer:

POST http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer

{
  "layer" : "geom",
  "lat" : "geolocation.lat",
  "lon" : "geolocation.lon"
}


I then create a geom spatial index:

POST http://localhost:7474/db/data/index/node/

{
  "name": "geom",
  "config": {
    "provider": "spatial",
    "geometry_type": "point",
    "lat": "geolocation.lat",
    "lon": "geolocation.lon"
  }
}


I finally add the node to the index:

POST http://localhost:7474/db/data/index/node/geom

{  
  "value": "dummy",
  "key": "dummy",
  "uri": "http://localhost:7474/db/data/node/5734"
}


I have a theory about how reindexing might be accomplished. First, I would remove the node from the geospatial index and then re-add it. But I'm concerned this may mess something up. I've read elsewhere that removing indexes and then adding them can create problems.

What is the proper way to reindex a node?

1

1 Answers

0
votes

It looks as if you can just call POST on the index again. I don't know what the implications of this are yet. I also don't know if it creates a new index/node. It does seem to update correctly from my limited testing.

Example:

POST http://localhost:7474/db/data/index/node/geom

{  
  "value": "dummy",
  "key": "dummy",
  "uri": "http://localhost:7474/db/data/node/5734"
}


You can verify that the index node was not duplicated by running the following Cypher query.

MATCH (node { id: 5734 }) 
RETURN node


Important: The above id is NOT to be confused with the actual ID of the geospatial node itself. It is a property for referring to the node that you indexed.