我从CSV文件将图形加载到Janusgraph中。加载数据后,我尝试使用compositeIndex
为图建立索引。建立索引后,状态将停留在INSTALLED
状态。
mgmt=graph.openManagement()
mgmt.getOpenTransactions().size()
==> 0
我已完成所有交易。
mgmt.buildIndex("querySpeedUp", Vertex.class).addKey(experimentid).addKey(regionid).addKey(sourcemfield).addKey(zcentroid).addKey(sourcesfield).buildCompositeIndex()
mgmt.awaitGraphIndexStatus(graph, 'fastTraversal').call()
mgmt.commit()
//opened new connection
mgmt = graph.openManagement()
gremlin> propkey = mgmt.getPropertyKey('experimentid')
==>experimentid
gremlin> byName.getIndexStatus(propkey);
==>INSTALLED
gremlin> mgmt.updateIndex(byName, SchemaAction.REGISTER_INDEX).get()
==>null
gremlin> byName.getIndexStatus(propkey);
==>INSTALLED
gremlin> mgmt.commit()
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@5f025000
gremlin> byName.getIndexStatus(propkey);
==>INSTALLED
gremlin> mgmt.awaitGraphIndexStatus(graph, 'querySpeedUp').call()
==>GraphIndexStatusReport[success=false, indexName='querySpeedUp', targetStatus=[REGISTERED], notConverged={sourcemfield=INSTALLED, sourcesfield=INSTALLED, regionid=INSTALLED, zcentroid=INSTALLED, experimentid=INSTALLED}, converged={}, elapsed=PT1M0.099S]
答案 0 :(得分:0)
我知道这是一个老问题,但是对于其他对此困扰不已的人,我发现我不得不在graph.tx().commit()
之后打电话给mgmt.commit()
,并为我解决了这个问题。