Searching for node in py2neo

对着背影说爱祢 提交于 2020-01-04 09:38:12

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/14681305/searching-for-node-in-py2neo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!