title: Neo4j and Lucene multikey queries (or: should I use Cypher?)
body: <p>I have a graph in Neo4j in which nodes represent random points in the plane, each node having the coordinates stored as properties (x and y, the value type is <code>double</code>).<br>
  I create the nodes and index them:</p>
  
  <pre><code>    IndexManager index = graph.index();
      Index&lt;Node&gt; nodesIndex = index.forNodes("points");
  
      for (int i = 0; i &lt; points.length; i++) {
          Point p = points[i]; 
          Node n;
  
          Transaction tx = graph.beginTx();
          try {
              n = graph.createNode();
              n.setProperty("x", p.getX());
              n.setProperty("y", p.getY());
  
              nodesIndex.add(n, "x", new ValueContext(p.getX()).indexNumeric());
              nodesIndex.add(n, "y", new ValueContext(p.getY()).indexNumeric());
  
              tx.success();
          } finally {
              tx.finish();
          }
      }
  </code></pre>
  
  <p>Now, what I need to do, is query for the nodes which are in a square area. So for example I made this query:</p>
  
  <pre><code>http://localhost:7474/db/data/index/node/points?query=x:[0.0 TO 3.0] AND y:[0.0 TO 3.0]
  </code></pre>
  
  <p>And this is the response:</p>
  
  <pre><code>    Node
      Properties
      y   1.0
      x   14.0
      Node info
      self    /db/data/node/10
  
      Node
      Properties
      y   1.0
      x   2.0
      Node info
      self    /db/data/node/7
  
      Node
      Properties
      y   1.0
      x   6.0
      Node info
      self    /db/data/node/8
  
      Node
      Properties
      y   1.0
      x   7.0
      Node info
      self    /db/data/node/9
  
  [Etc...]
  </code></pre>
  
  <p>As you see it is not working. And I don't understand why (maybe I need to configure the index?).<br>
  Note that I haven't <em>got</em> to use Lucene. If there is a way to gather that information with Cypher (starting from a node centered in the square area) would be actually better, for I also need the relationships between the nodes found.  </p>
  
  <p><strong>Additional informations</strong>
  If that matters, the graph represents a Delaunay triangolation on a random set of points on the plane. In more abstract terms, I need to "extract" the entire subgraph that lays in a given area.  </p>
  
  <p>Any help is really appreciated!</p>