Nacho Lobo
Nacho Lobo

Reputation: 31

Neo4j Monitoring and Management tool: Indexing issue + connection to java embedded applicatiions

I am using the Neo4j Monitoring and Management tool (localhost:7474, Neo4j v 1.8.2) because I think that it is a good way to visualize the data. I am facing some issues though:

  1. I created an index called auto_node_index. (I also enabled auto indexing though this should not matter here) When I run the following statements for instance:

CREATE n = {type : 'company', name : 'neo4j'} RETURN n START n=node:auto_node_index(name='neo4j') RETURN n

I don't get any matching data, but instead: Returned 0 rows. Query took 25ms Where am I wrong?

2.How can I make visible data that I created with an embedded java application and vice versa? Since Neo4j stores it data in /var/lib/neo4j/data/graphdb I tried to configure the path of the GraphDatabaseService like that:

String DB_PATH = "cd /var/lib/neo4j/data/graphdb"; GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );

which obviously does not work, since the directory is created and it not switched into there. Sorry, I'm quite a newbee to this.

Any hints are greatly appreciated ;) Thanks a lot!

Upvotes: 0

Views: 610

Answers (1)

Luanne
Luanne

Reputation: 19373

  1. You won't get any matches because Cypher will not add your node n to the index you manually created. If you turned on auto indexing, then it should be available in the node_auto_index, not auto_node_index. If you want to add nodes to a manually created index, then as of now, the nodes created by Cypher cannot be indexed into that index via Cypher (though it is something that I've heard will be available in a future release). You can go about this in two ways.

a) Create the node using Cypher and return the created node. In your Java app, get that node and add to the index manually (see http://docs.neo4j.org/chunked/milestone/indexing.html for info on how to do that)

b) Create the node using the Neo4j API in Java and index it

2

If you want to use Java to create a graph, use any path that you have permissions to write to (it does not always have to be var/lib/neo4j/graphdb) :

String DB_PATH = "/var/lib/neo4j/data/graphdb"; 
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );

then you can point webadmin to the path in DB_PATH by setting this in conf/neo4j-server.properties

org.neo4j.server.database.location=/var/lib/neo4j/graphdb

Upvotes: 1

Related Questions