首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Neo4J:批处理执行时的自动索引

Neo4J:批处理执行时的自动索引
EN

Stack Overflow用户
提问于 2014-01-27 03:40:09
回答 1查看 138关注 0票数 1

是否可以使用自动索引功能在Neo4J上导入数据?我正在尝试使用BatchInserter和BatchInserterIndex导入数据,如以下示例所示:

代码语言:javascript
复制
BatchInserter inserter = BatchInserters.inserter("/home/fmagalhaes/Neo4JDatabase");
BatchInserterIndexProvider indexProvider = new LuceneBatchInserterIndexProvider(inserter);
BatchInserterIndex nodeIndex = indexProvider.nodeIndex("node_auto_index", MapUtil.stringMap("type","exact"));
BatchInserterIndex relIndex = indexProvider.relationshipIndex("relationship_auto_index", MapUtil.stringMap("type","exact"));
...
inserter.createNode(vertexId, properties);
nodeIndex.add(vertexId, properties);
...

问题是,当批处理完成时,我尝试通过执行以下操作使用Blueprints通用API打开此数据库:

代码语言:javascript
复制
Graph g = new Neo4jGraph("/home/fmagalhaes/Neo4JDatabase");
Set<String> nodeIndices = ((KeyIndexableGraph)g).getIndexedKeys(Vertex.class);
Set<String> relIndices = ((KeyIndexableGraph)g).getIndexedKeys(Edge.class);

并且nodeIndices和relIndices都是空的。当我在Blueprints API上打开图形数据库时,自动索引功能被禁用。有没有可能在批处理过程中创建一个自动索引,这样当我使用Blueprints API打开数据库时,这个索引将是可见的(并且将继续自动索引数据,因为属性被添加到顶点和边)?

EN

回答 1

Stack Overflow用户

发布于 2014-01-27 19:31:04

  1. 您必须彻底关闭batch-index以及batch inserter
  2. 您可能不想为所有属性编制索引,只需关闭用来查找节点的关键字
  3. 您必须在neo4j配置中为稍后启动的数据库以及在all期间编制索引的相同属性启用自动索引
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21368277

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档