用“IN"查询子句使用 Neo4j 中的索引和 Cypher [英] querying with an "IN" clause using the index in neo4j with Cypher
问题描述
我想在 neo4j 中使用我的 auto_index 并传入要匹配的字符串数组.我知道您可以在密码查询的末尾添加一个 IN 子句,但这不使用索引,我假设将对所有记录进行数据库扫描.使用索引查询执行此操作的最佳方法是什么?
I'd like to use my auto_index in neo4j and pass in an array of strings to match against. I know that you can add an IN clause to the end of your cypher query but that doesn't use the indexes and I'm assuming will do a database scan of all the records. What's the best way to do this with an index query?
例如假设 facebookId 上有一个 auto_index 并且有 100 万个用户节点,请获取 facebookId 在 ["123", "456", "789"] 中的用户.
e.g. Get me users whose facebookId is in ["123", "456", "789"] assuming there is an auto_index on facebookId and there are 1 million user nodes.
推荐答案
我认为这值得作为答案发布:
I suppose this is worth posting as an answer:
START n=node:node_auto_index('facebookId:("123", "456", "789")')
...
示例:http://console.neo4j.org/r/3mcvr5
这篇关于用“IN"查询子句使用 Neo4j 中的索引和 Cypher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!