我在索引与 Titan 一起工作时遇到了一些麻烦。我配置我的索引如下:
TitanGraph graph = TitanFactory.open("conf/titan-cassandra-es.properties");
TitanManagement management = graph.openManagement();
String indexKey = "byItemIdentifier";
String propertyKey = "ITEM_IDENTIFIER";
TitanIndex index = management.getGraphIndex(indexKey);
PropertyKey key = management.makePropertyKey(propertyKey).dataType(String.class).make();
management.buildIndex(indexKey, Vertex.class).addKey(key, Mapping.STRING.asParameter()).buildMixedIndex("search");
management.commit();
现在的问题:
Vertex vertex = graph.addVertex();
vertex.property(propertyKey, "www.foo.com/bar");
graph.commit();
然后稍后我尝试以下操作:
graph.traversal().V().has(propertyKey, "foo").hasNext(); //(1)
graph.traversal().V().has(propertyKey, "bar").hasNext(); //(2)
graph.traversal().V().has(propertyKey, "www.foo.com/bar").hasNext(); //(3)
(1) =false
, (2) =false
和(3) =false
。这是怎么回事?当然(3)应该返回true
?我是否配置错误?