title: cypher 2.0 : using label based index to search a set of nodes
body: <p>I have <code>users</code> and <code>groups</code> they belong to.
  I have an index n:Group(name)</p>
  
  <p>I want to search for all users belong to a set of groups : ["gr1","gr2","gr3"]</p>
  
  <p>which other groups they belong to.</p>
  
  <p>so I have the following query:
  Query : </p>
  
  <pre><code>MATCH (gr:Group) &lt;--(us:User)--(gr2:Group)
  WHERE gr.name in ["gr1","gr2"]
  return distinct gr2
  </code></pre>
  
  <p>The thing here, is that I think that cypher don't use the index because the query is to slow.</p>
  
  <p>I have 2k nodes, 50k relationships. 
  The following query takes between 200 to 700 ms (depending on cache):</p>
  
  <pre><code>MATCH (gr:Group) &lt;--(us:User)--(gr2:Group)
  WHERE gr.name = "gr1"
  return distinct gr2
  </code></pre>
  
  <p>However, the following query, takes between 2 to 6 seconds!</p>
  
  <pre><code>MATCH (gr:Group) &lt;--(us:User)--(gr2:Group)
  WHERE gr.name in ["gr1"]
  return distinct gr2
  </code></pre>
  
  <p>When I'm trying to do :</p>
  
  <pre><code>MATCH (gr:Group) &lt;--(us:User)--(gr2:Group)
  using index gr:Group(name)
  WHERE gr.name in ["gr1"]
  return distinct gr2
  </code></pre>
  
  <p>I get the following error: </p>
  
  <pre><code>Cannot use index hint in this context. The label and property comparison must be specified on a non-optional node
  Label: `Group`
  Property name: `name`
  </code></pre>
  
  <p>(with "=" instead of "in" I get no  error)</p>
  
  <p>I'm using neo4j enterprise 2.0.1 . The test results are from running on the neo4j browser .</p>