chayrix
chayrix

Reputation: 51

Searching for node in py2neo

Is there a way to search for a node with a specific property using py2neo? (I have a bunch of nodes with {"word": "some word"}, and I want to be able to search through nodes to find a node whose word attribute has a specific value)

Upvotes: 2

Views: 642

Answers (1)

Nigel Small
Nigel Small

Reputation: 4495

I suggest that you consider using an index for this kind of requirement. You can index the nodes against the properties you need to search for and then refer to this index for your search.

Otherwise, you're left with a reasonably non-performant Cypher query:

START n=node(*) 
WHERE n.word! = 'some word' 
RETURN n

I'd recommend against using this though as it will have to sift through the entire database and therefore be very resource hungry and slow as your database grows.

Upvotes: 2

Related Questions