1

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?

Levi Roberts
  • 1,277
  • 3
  • 22
  • 44

1 Answers1

0

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.

Levi Roberts
  • 1,277
  • 3
  • 22
  • 44
  • 1
    I think you have to remove / delete the node from the index first before you add it again. – Michael Hunger Jun 30 '15 at 07:58
  • That was my first assumption however this seems to be working at the moment. I'm leaving this question as unanswered in case this is not the correct way to do it. – Levi Roberts Jun 30 '15 at 08:25