Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Inconsistent indices behaviour in Neo4jGraph #200

Closed
jakewins opened this Issue · 7 comments

3 participants

@jakewins

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:

gremlin> g.indices
==> MANUAL[foo:Vertex]

Then secondly adding another index bar with the Index Manager (or from my app over REST), and thirdly listing the indices again:

gremlin> g.indices
==> MANUAL[foo:Vertex]

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?

Thoughts on this, anyone?

My environment: neo4j-community-1.6.M02

@simlun

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:

  • It is either the Neo4j web console which is hanging on to the Neo4jGraph instance and does not give the user a choice to create a new instance easily.
  • Or it's the way the Blueprints Neo4jGraph is caching the indices, only updating the indices Map when updating the indices using that exact same Neo4jGraph instance.
@jakewins

@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?

@simlun

@jakewins yeah, you are right, It does apply when only using Neo4jGraph.

What are the possible solutions?

  • Make Neo4jGraph to always keep in sync with the real indices?
  • Make it possible to manually update the indices Map in Neo4jGraph?
  • <insert suggestions here>
@jakewins

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 :)

@okram
Owner

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.

@simlun

Excellent! :)

@okram
Owner

Fixed. No longer does there exist an index caching layer in Blueprints Neo4jGraph. All index calls directly access neo4j.index(). Test cases pass.

@okram okram closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.