python - neo4jrestclient 索引结果返回 Iterable 而不是 node/url?

标签 python indexing neo4j neo4j.py

我正在尝试遵循文档 http://readthedocs.org/docs/neo4j-rest-client/en/latest/indices.html

我希望索引查询返回一个节点,但它返回的是“Iterable: Node”:

db = GraphDatabase("http://localhost:7474/db/data")
playerIndex = db.nodes.indexes.get("index1")
playerNode = db.nodes.create(player_id = "Homer")
playerIndex.add("player_id", "Homer", playerNode)
print playerIndex["player_id"]["Homer"], "\n", playerNode

打印:

<Neo4j Iterable: Node>
<Neo4j Node: http://localhost:7474/db/data/node/157>

如何获取 neo4jrestclient 索引查询结果以返回像第 2 行这样的节点?

最佳答案

索引查找可以返回多个节点,因此在这种情况下,它返回一个迭代器。要获取迭代器中的下一项,请执行 .next():

print playerIndex["player_id"]["Homer"].next(), "\n", playerNode

参见:https://github.com/versae/neo4j-rest-client/blob/master/neo4jrestclient/iterable.py

关于python - neo4jrestclient 索引结果返回 Iterable 而不是 node/url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10526593/

相关文章:

sql-server - 忙表,索引还是不索引

javascript - 如何找到这个数组值的索引号?

neo4j - 对同一集合的不同属性使用 equals 不会返回任何记录,为什么?

java - 如何使用@StartNode 关系查询 Neo4jRepository?

python - Pandas 将索引排序为整数

javascript - 从 Python 提交基于 Silverlight 的表单(也许使用 JS?)

python - 最小化 QTreeWidgetItem 中 QTextEdit 的大小

MySQL 唯一和 NULL 索引建议

Neo4J Cypher 通过多种关系类型匹配 - 奇怪的行为

python - 来自 Groupby Python 的多列数据透视表