tags:

views:

29

answers:

1

I'm using the BatchInsert and LuceneIndexBatchInserter api's to create my graph (~10000 nodes for now). The thing is BatchInserter.createNode(...) returns a long.

BatchInserter inserter = new BatchInserterImpl( DB_PATH, BatchInserterImpl.loadProperties(   "neo4j.props" ) );
long node = inserter.createNode(properties);

where properties is a Map(String,Object).

What I really need is to get a new node of type Node.

Node node = inserter.createNode(properties);

This way I can use the shortestPath api and pass in a startNode and targetNode.

So, basically, is there someway that I can get a node from the Index as a Node and not a long?

Maybe if someone could just explain why the batchInserter returns a node of type long instead of type Node? Hope this makes sense to someone, Thanks.

A: 

The batch inserter isn't intended for normal usage, it's only for inserting data. If you look at the wiki page you'll see that you use the longs when creating the relationships. SO what you do is:

  1. insert data
  2. shutdown batchinserter
  3. start graphdb
  4. go ahead with shortest path and whatever you like
nawroth
Wouldn't I have to start the graphdb before shutting down the batchInserter in order to transfer the indexes to the graphdb so I can use them? or am I missing something?btw Thanks for the help
mmay
Not sure what you mean here, but when shutting the batchinserter down the data will be in the DB, and after starting the embedded graphdb you can read from and write to this DB. Maybe this is what you're looking for: [Indexing with BatchInserter](http://wiki.neo4j.org/content/Indexing_with_BatchInserter) ?
nawroth
Okay I got it. I was under the impression that when you shut down the BatchInserter and IndexBatchInserter the indexes would be deleted. I can see that this is not the case though. Thanks!
mmay