问题
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?
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.
回答1:
I suppose this is worth posting as an answer:
START n=node:node_auto_index('facebookId:("123", "456", "789")')
...
Example: http://console.neo4j.org/r/3mcvr5
回答2:
You would do this query by having an explicit index lookup, like
start user = node:node_auto_index('facebookId:123 OR facebookId:456') match ...
http://console.neo4j.org/r/nj98lt for an example.
来源:https://stackoverflow.com/questions/13634179/querying-with-an-in-clause-using-the-index-in-neo4j-with-cypher