Copy pasted from @simlun's issue on neo4j community repo:
I noticed a strange behavior when dealing with creating indices and listing them in the Gremlin console.
When using the Gremlin console, the g instance stores the indices in a Map (src).
This is a problem when I'm firstly listing the indices:
Then secondly adding another index bar with the Index Manager (or from my app over REST), and thirdly listing the indices again:
Notice that that method only lists the previously cashed indices... The only way I can reset it is to $ ./bin/neo4j restart which feels a bit overkill, doesn't it?
$ ./bin/neo4j restart
Thoughts on this, anyone?
My environment: neo4j-community-1.6.M02
Note that this is a problem when using the Neo4j Web console in "Gremlin mode". For normal Neo4jGraph usage with only one instance of it is okay.
Depending on how you look at it the cause of the problem could be two things:
@simlun ah, didn't think of that. Still feels like a Neo4jGraph issue to me, since this would apply as well if someone from the outside has created an index after Neo4jGraph was instantiated, if I understand correctly?
@jakewins yeah, you are right, It does apply when only using Neo4jGraph.
What are the possible solutions?
<insert suggestions here>
There is a loadIndices private method that loads the indices from neo4j, but it seems to come with sideffects.. We'll see what @okram says :)
Yes. This is a problem. I'm assuming that access is only via Neo4jGraph. I will work on making sure that indices are ALWAYS retrieved via Neo4j methods and not via Blueprints local Map Cache.
Fixed. No longer does there exist an index caching layer in Blueprints Neo4jGraph. All index calls directly access neo4j.index(). Test cases pass.