Indexing TitanDB未使用索引进行查询

Indexing TitanDB未使用索引进行查询,indexing,titan,Indexing,Titan,我已经在两个属性上创建了索引: mgmt.buildIndex("userId", Vertex.class).addKey(mgmt.makePropertyKey("userId").dataType(Integer.class).make()).buildCompositeIndex(); mgmt.buildIndex("firstNameIndex", Vertex.class).addKey(mgmt.makePropertyKey("firstName").dataType(St

我已经在两个属性上创建了索引:

mgmt.buildIndex("userId", Vertex.class).addKey(mgmt.makePropertyKey("userId").dataType(Integer.class).make()).buildCompositeIndex();

mgmt.buildIndex("firstNameIndex", Vertex.class).addKey(mgmt.makePropertyKey("firstName").dataType(String.class).make()).buildCompositeIndex();
在Gremlin shell上,我可以看到已经创建了索引:

g.getIndexedKeys(Vertex.class)
==>userId
==>firstName
现在,当我像最简单的一样查询顶点时:

gremlin> g.V()
18:33:42 WARN  com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx  - Query requires iterating over all vertices [()]. For better performance, use indexes
==>v[512]
==>v[256]
或者一些复杂的问题:

gremlin> g.V.has('firstName' ,CONTAINS,'Raj')
18:36:00 WARN  com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx  - Query requires iterating over all vertices [(firstName CONTAINS Raj)]. For better performance, use indexes
==>v[512]
为什么不使用索引进行查询

索引的创建和关键索引之间有什么区别吗。? 任何解释都会有帮助

谢谢

基于

使用复合索引进行精确的匹配索引检索。混合成的 索引不需要配置或操作外部索引 系统和索引通常比混合索引快得多

作为例外,当数字为 查询约束的不同值的数目相对较小,或者 值应与图中的许多元素关联 (即在选择性低的情况下)。使用混合索引表示数值 范围、全文或地理空间索引。此外,使用混合索引 可以通过()查询加快order()的速度

在您的情况下,您似乎正在进行全文搜索,您需要使用混合索引,因为复合索引仅用于精确匹配

有关全文搜索索引的更多信息,请访问:

我看不出索引和关键索引之间有任何区别。以顶点为中心的索引不同于属性/关键点索引。看看我提供的链接。希望这有帮助