Neo4j-php retrieve node

久未见 提交于 2019-12-13 03:27:22

问题


I have been exclusively using cypher queries of this client for Neo4j because there is no out of the box way of doing many things. One of those id to get nodes. There is no way to retrieve them without knowing their id, which is very low level. Any idea on how to run a

$client->findOne('property','value');

?

It should be straightforward but it isn't from the documentation.


回答1:


Make Indexes on the properties you want to search, from a newly created $personNode

$personIndex = new \Everyman\Neo4j\NodeIndex($client, 'person');
$personIndex->add($personNode, 'name', $personNode->name);

Then later to search, the new PHP object $personIndex will reference the same, populated index as above.

$personIndex = new \Everyman\Neo4j\NodeIndex($client, 'person');
$match = $personIndex->findOne('name', 'edoceo');


来源:https://stackoverflow.com/questions/29059575/neo4j-php-retrieve-node

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