开发者

How to use Neo4j BatchInserted nodes after they have been created and indexed?

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:

  1. insert data
  2. shutdown batchinserter
  3. start graphdb
  4. go ahead with shortest path and whatever you like
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜