How to check if node is indexed in neo4j-spatial index?

I am running the latest version of neo4j v2 with the spatial plugin installed. I managed to index almost all the nodes that I need to index in the geoinformer. One of the problems I am facing is how can I easily check if a node is indexed?

I cannot find the REST endpoint to get this information, and it is not easy to get to it with cypher. But I tried this query because it seems to give me the result I want, except that the runtime is unacceptable.

MATCH (a)-[:RTREE_REFERENCE]->(b) where b.id=989898 return b;

As soon as the geo index stores a reference to a node that has been indexed in the id property value of the node referenced by the RTREE_REFERENCE relation, I realized that this could be the way to go.

Now this query is being executed: 14459 msbeing executed from neo4j-shell.

My database is small, oh 41000 nodeswhich I want to add to the spatial index as a whole.

There must be a better way to do this. Any idea and / or pointer would be greatly appreciated.

+4
source share
2 answers

Since you know the identifier of your node data, you can access it directly in Cypher without an index and just check the incoming RTREE_REFERENCE relationships:

START n=node(989898) MATCH (p)-[r:RTREE_REFERENCE]->(n) RETURN r;

As the node side, your Cypher had the syntax "WHERE n.id = 989898", but if it is the internal identifier of the node, then this will not work, since n.id will look for the property with key 'id'. For the internal node identifier, use 'id (n)'.

'id' node ( ID), , @deemeetree , .

+1

, , , : RTREE_REFERENCE id .

node, , ?

, node, , .

Neo4J, ( ):

START n=node(*) SET n:YOUR_LABEL_NAME

node id.

CREATE INDEX ON :YOUR_LABEL_NAME(id)

, :

MATCH (b:YOUR_LABEL_NAME{id:"989898"}), a-[:RTREE_REFERENCE]->b RETURN a,b;

.

, , , b , ...

0

Source: https://habr.com/ru/post/1523648/


All Articles