2

我在构建 JanusGraph 混合索引时有一些问题。这是我的代码:

mgmt = graph.openManagement();
idx = mgmt.getGraphIndex('zhh1_index');
prop = mgmt.getPropertyKey('zhang');
mgmt.addIndexKey(idx, prop);
prop = mgmt.getPropertyKey('uri');
mgmt.addIndexKey(idx, prop);
prop = mgmt.getPropertyKey('age');
mgmt.addIndexKey(idx, prop);
mgmt.commit();
mgmt.awaitGraphIndexStatus(graph, 'zhh1_index').status(SchemaStatus.REGISTERED).call();
mgmt = graph.openManagement();
mgmt.updateIndex(mgmt.getGraphIndex('zhh1_index'),SchemaAction.ENABLE_INDEX).get();
mgmt.commit();
vertex2=graph.addVertex(label,'zhh1');
vertex2.property('zhang','male');
vertex2.property('uri','/zhh1/zhanghh');
vertex2.property('age','18');
vertex3=graph.addVertex(label,'zhh1');
vertex3.property('zhang','male');
vertex3.property('uri','/zhh1/zhangheng');

当程序执行这一行时:

mgmt.awaitGraphIndexStatus(graph, 'zhh1_index').status(SchemaStatus.REGISTERED).call();

日志打印这些信息(大约 30 秒后,出现这样的异常:睡眠被中断):

GraphIndexStatusReport[success=false, indexName='zhh1_index', targetStatus=ENABLED, notConverged={jiyq=INSTALLED, zhang=INSTALLED, uri=INSTALLED, age=INSTALLED},收敛={}, elapsed=PT1M0.096S]

我对此感到非常困惑!

它不断为我拥有的所有索引打印很多内容。我做错什么了吗?如何避免此类消息?

当我单独执行如下语句时,报如下异常:

异常:java.util.concurrent.ExecutionException: mgmt.updateIndex(mgmt.getGraphIndex('zhh1_index'),SchemaAction.ENABLE_INDEX).get(); org.apache.tinkerpop.gremlin.driver.exception.ResponseException:无法在空对象上调用方法 get()

4

2 回答 2

1

您的索引似乎卡在INSTALLED状态中,这可能是由于以下几个原因:请参阅这篇文章并查看我的答案——特别是第 2、3 和 5 号项目符号。

于 2017-09-02T14:52:06.323 回答
0

你什么时候buildMixedIndex()?可能需要 REINDEX 程序。

于 2017-09-02T11:15:02.283 回答