Closed amosjyng closed 8 years ago
Could you post the entire piece of the code where you're creating your GraphDatabaseService
? If you're using the properties approach, it needs to look something like:
GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(pathToDb)
.loadPropertiesFromFile(this.getClass().getClassLoader().getResource("neo4j.properties").getPath())
.newGraphDatabase();
Thanks, this is my initialization code:
String neo4jSettingsPath = Database.class.getClassLoader().getResource("neo4j.properties").getPath();
this.neo4jdb = new GraphDatabaseFactory()
.newEmbeddedDatabaseBuilder(new File("test.db"))
.loadPropertiesFromFile(neo4jSettingsPath)
.newGraphDatabase();
RuntimeRegistry.getRuntime(this.neo4jdb).waitUntilStarted();
try (Transaction tx = this.neo4jdb.beginTx())
{
assert this.neo4jdb.index().existsForNodes("uuidIndex");
}
ok, second pair of eyes didn't help, so I had to debug through this only to find out you're asserting the wrong thing :)
So, either change your config to
com.graphaware.module.UIDM.uuidIndex=uuidIndex
or your test to
assert this.neo4jdb.index().existsForNodes("nodeIndex");
D'OH! Hahahaha, thanks!
Though... I still can't seem to get the assertion to pass, and no indices seem to be created either. I've created a small program that produces the problem I'm seeing, would you be willing to take a look at that? I'm sure it's something stupid again, just can't figure out what it is. Sorry for the trouble.
Two problems with your app: 1) you need to create a node first that is indexed, in order to see the index 2) you're asserting a schema index, but this module uses legacy indexes. The reason for that is that schema indexes are tied to labels, but we want to create the index no matter what labels your node has, even if it has none.
I issued a pull request to your repo that demonstrates what I just said
I see, that works, thank you so much! :)
Hi,
I'm trying to use this in Embedded Mode, and am running into difficulties.
The GraphAwareRuntime seems to get successfully started, as this runs without problems:
But then this assertion fails:
and of course the created nodes have no
uuid
property.My
neo4j.properties
containsAny ideas what I might be doing wrong?
Thanks!