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 expl开发者_StackOverflow中文版ain why the batchInserter returns a node of type long instead of type Node? Hope this makes sense to someone, Thanks.
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:
- insert data
- shutdown batchinserter
- start graphdb
- go ahead with shortest path and whatever you like
精彩评论