Reputation: 47861
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.
Upvotes: 5
Views: 2613
Reputation: 33145
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
Upvotes: 11
Reputation: 6331
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.
Upvotes: 1