尝试按名称查询的示例数据集

时间:2013-03-07 19:38:19

标签: neo4j

我正在尝试neo4j,我从here下载并成功配置了示例数据集cineasts_39_movies_446_actors.zip

我可以查询节点1:

neo4j-sh (0)$ START n=node(1) RETURN n
==> +------------------------------------------------------------------------------------------------------------------------------------------------------------+
==> | n                                                                                                                                                          |
==> +------------------------------------------------------------------------------------------------------------------------------------------------------------+
==> | Node[1]{login:"micha",roles:["ROLE_ADMIN","ROLE_USER"],name:"Micha",password:"339f455efd4af00b3e62385f3b7ef694",__type__:"org.neo4j.cineasts.domain.User"} |
==> +------------------------------------------------------------------------------------------------------------------------------------------------------------+

如何查询名称为Micha的节点?感谢

1 个答案:

答案 0 :(得分:3)

怎么样:

start n=node:User("login:micha") return n;

索引查找的语法如下:

<node/relationship>:<index name>(<lucene query/shorthand single field lookup>)

速记看起来像这样,并且更容易参数化:

start n=node:User(login="micha") return n;

并在JSON中进行参数化,如下所示:

{query:"start n=node:User(login={username}) return n;", params:{username:"micha"}}