0
votes

I'm using the neo4j browser to search for a node in my graph by label. I know the node exists and the label on the node is correct, but when I specify the label on the node, neo4j can't find it.

More specifically, I use the following cypher query in the neo4j browser:

match (a:Foo) where a.value = "Bar" return a
(no changes, no records)

However a node with that value does exist with that label:

match (a) where a.value = "Bar" return labels(a)
["Foo"]

There is an index on that label, but I don't know if that is relevant.

:schema
Indexes
   ON :Foo(value) ONLINE 

Additionally, explicitly resetting the label doesn't seem to work:

match (a) where a.value = "Bar" 
set a :Foo
return a

Will return the node with the correct label applied, but when I retry my original query it still cannot find the node.

This has worked previously, but I have made some changes recently to our heap size/ page cache size /gc type trying to run down another issue with 100% cpu hangs on garbage collection. None of those changes should have affected labels.

Has anyone had this experience before?

I'm using Neo4j CE v3.3.0

2
Does doing a REMOVE a:Foo before the SET help? If not, and this is a problem with just a single node, you could try replacing that node with a new one (and re-creating all its relationships as well).cybersam
@cybersam Adding the REMOVE still "worked" in that it didn't throw an error or anything, but I still can't find that node by label.jkeuhlen
It may be worth dropping the index then creating it again. I have a feeling somehow your index is corruptedInverseFalcon
@InverseFalcon, I dropped and recreated it and that seemed to solve the problem. Any idea what could have caused it? Or a way to detect it?jkeuhlen

2 Answers

1
votes

Looks like an issue of index corruption, as mentioned in my comment, dropping then creating the index again should fix it.

As to how the index got corrupted, I can't say, but you are using a .0 release, and those tend to have more bugs than others. You may want to upgrade to the latest 3.3.x release.

You can always run the consistency check via neo4j-admin to see if anything else might be going on with your graph data.

0
votes

This did not work

MATCH ( p:item {name:"spam"}) RETURN p.name

(no changes, no records)

But this did work:

Match (n:item) Where n.name =~ '.*spam.*' Return n.name, n.purchase

n.name  n.purchase

"""spam"""  8