Reputation: 684
My problem is really a basic example of using labels in Neo4j 2.0.M5. I try to drop all nodes and relationships, then I drop old 'Person' index, then I create a new 'Person' index based on 'name' property, then I create a node labeled 'Person' with name 'John Doe', to finally retrieve this node.
Cypher:
START n=node(*) MATCH n-[r?]-m WITH n, r DELETE n, r
DROP INDEX ON :Person(name)
CREATE INDEX ON :Person(name)
CREATE (n:Person {name:'Jhon Doe'})
start n=node:Person(name='Jhon Doe') return n
All works well, except at the end, when I try to retrieve my node. Neo4j throws an error :
Index `Person` does not exist
I try without creating the index, but it also doesn't work.
It's a really simple case, do you see the problem ?
Upvotes: 2
Views: 318
Reputation: 71023
For Neo4j 2.0, start
is no longer necessary, and your query can be expressed as:
match (n:Person)
where n.name='Jhon Doe'
return n;
With the start
syntax, you're specifying an index name. With v2.0, when creating an index based on a label, I don't believe the index can be referenced by name (as it's never been given a name; you've just told Neo4j to index nodes with the label Person
based on the property name
). Since there's no index called Person
, this is probably why you're seeing that error.
Upvotes: 3