2013-03-22 36 views
1

我在索引节点具有以下性质研究的一个节点:Neo4j的查询使用python其余客户

{'user_id': u'00050714572570434939', 'hosts': [u'http://shyjive.blogspot.com/'], 'follows': ['null']} 

现在我有指标,我想简单的查询索引得到节点为:

index = gdb.nodes.indexes.create('blogger2') 
uid = gdb.nodes.create() 
uid["hosts"] = ['http://shyjive.blogspot.com/'] 
uid["user_id"] = "00050714572570434939" 
uid["follows"] = ['null'] 
print index["user_id"]["00050714572570434939"][:] 

This returns [],这里有什么问题!!

原因,我正在使用Python列表上的Neo4j小组建议由开发商是我想多属性值存储节点,所以不是阵列我使用列表这里

回答

1

首先需要指数节点。如果你不使用automatic indexing,为neo4j-rest-client代码将是:

index["user_id"]["00050714572570434939"] = uid 

现在您有:

>>> index["user_id"]["00050714572570434939"][:] 
[<Neo4j Node: http://localhost:7474/db/data/node/38>] 
+0

感谢您的时间,但是当我试图索引列表,因为我要添加多重价值) \t UID = gdb.nodes.create( \t指数[ “USER_ID”] [X] = UID \t指数[ “主机”] [源] = UID :节点的用于例如一个属性指数[“跟随”] [地址]上述源和dest = UID 是列表,以便它使我错误: TX = TX或值[1] IndexError:列表索引超出范围 – Harshit 2013-03-26 06:00:20

+1

不幸的是,不支持但列表作为索引键。但它来了! – 2013-03-28 22:06:09