Note that there are some explanatory texts on larger screens.

plurals
  1. POneo4j 2.0 findNodesByLabelAndProperty not working
    text
    copied!<p>I'm currently trying the Neo4j 2.0.0 M3 and see some strange behaviour. <strong>In my unit tests, everything works as expected</strong> (using an <code>newImpermanentDatabase</code>) but in the real thing, I <strong>do not get results</strong> from the <code>graphDatabaseService.findNodesByLabelAndProperty</code>.</p> <p>Here is the code in question: </p> <pre><code>ResourceIterator&lt;Node&gt; iterator = graphDB .findNodesByLabelAndProperty(Labels.User, "EMAIL_ADDRESS", emailAddress) .iterator(); try { if (iterator.hasNext()) { // =&gt; returns false** return iterator.next(); } } finally { iterator.close(); } return null; </code></pre> <p>This returns no results. However, when running the following code, I see my node is there (The MATCH!!!!!!!!! is printed) and I also have an index setup via the schema (although that if I read the API, this seems not necessary but is important for performance):</p> <pre><code>ResourceIterator&lt;Node&gt; iterator1 = GlobalGraphOperations.at(graphDB).getAllNodesWithLabel(Labels.User).iterator(); while (iterator1.hasNext()) { Node result = iterator1.next(); UserDao.printoutNode(emailAddress, result); } </code></pre> <p>And UserDao.printoutNode</p> <pre><code>public static void printoutNode(String emailAddress, Node next) { System.out.print(next); ResourceIterator&lt;Label&gt; iterator1 = next.getLabels().iterator(); System.out.print("("); while (iterator1.hasNext()) { System.out.print(iterator1.next().name()); } System.out.print("): "); for(String key : next.getPropertyKeys()) { System.out.print(key + ": " + next.getProperty(key).toString() + "; "); if(emailAddress.equals( next.getProperty(key).toString())) { System.out.print("MATCH!!!!!!!!!"); } } System.out.println(); } </code></pre> <p>I already debugged through the code and what I already found out is that I pass via the <code>InternalAbstractGraphDatabase.map2Nodes</code> to a <code>DelegatingIndexProxy.getDelegate</code> and end up in <code>IndexReader.Empty</code> class which returns the <code>IteratorUtil.EMPTY_ITERATOR</code> thus getting <code>false</code> for <code>iterator.hasNext()</code></p> <p>Any idea's what I am doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload