Hi Jacopo The reason for this (I suspect) would be that IndexHits isn't really an Iterable, as it doesn't fulfill that contract (you can read about it in the javadoc). So I'd guess this will work if you instead ask the query twice, or if you keep the nodes gotten from the for-loop in a Collection and instead check if myCollection.size()==1
2010/7/5, Jacopo <[email protected]>: > Hi all > I've a problem I cannot explain myself in Neo4j. > I want to eliminate nodes with the idcat property values read from a > file. > > So I look in the index (LuceneIndexService) for this property, and if > the number of result is 1 I proceed to delete relationships for that > node in order to be able to eliminate the node itself. > > But when I try to get the node sometimes I get a NullPointerException in > the last line of this slice of code. > > int idcat=Integer.parseInt(line.split(" ")[1]); > IndexHits<Node> nodes = index.getNodes("idcat", idcat); > > for(Node n:nodes){ > System.out.println("nodes.size:"+nodi.size()+" > properties:"+n.getPropertyKeys()); > } > > if(nodes.size()==1){ > Node el=index.getSingleNode("idcat", idcat); > while(el.hasRelationship()){...} > > I controlled with the debugger and the variable el is actually null. The > cycle of println() too doesn't iterate, making me think "nodes" is > really empty. > > But so why nodes.size() returns 1 ? > > Thanks, > Jacopo > > > > > > -- > Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP > autenticato? GRATIS solo con Email.it http://www.email.it/f > > Sponsor: > VOGLIA DI VACANZE ? > * A Riccione i Riviera Park Hotels sono gli alberghi specializzati per le > vacanze nei parchi divertimento.Vieni nei Riviera Park Hotels! Ti aspettano > sconti per tutti i parchi della Romagna! Prenota subito on-line la tua > vacanza! > Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=10607&d=5-7 > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [[email protected]] Hacker, Neo Technology www.neotechnology.com _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

