Cosmos DB 搜索查询,它采用任何字符的顶点值

Cosmos DB Search Query which takes Vertex values with any character

我正在使用 Azure cosmos Db,在 cosmosDB 中我有很多顶点,每个顶点都有键值形式的属性。我想找到任何检查以任何字符开头的顶点值的 gremlin 查询。 有过滤器查询,但不支持 azure 过滤器查询,那么是否有任何其他 Gremlin 查询采用以任何字符开头的 Vertex 属性值?

“以任何字符开头”需要全文搜索,但 Cosmos DB 根据其文档不支持它 https://docs.microsoft.com/en-us/azure/cosmos-db/gremlin-support#gremlin-steps

JanusGraph 支持全文搜索或字符串搜索,例如:

g.V().has('bookname', textPrefix('uni'))

更多信息请参考http://docs.janusgraph.org/latest/index-parameters.html#text-search

虽然我自己从未尝试过 CosmosDB,但我不得不不同意 John 的观点。根据 CosmosDB 的文档,任何 属性 上的任何范围查询都是从索引 处理的。因此,如果你想找到所有 person 具有以 a 开头的 name 属性 的顶点,你可以这样做:

g.V().has("person", "name", between("a", "b"))`

TinkerPop 玩具图的具体示例:

gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().has("name", between("m", "n")).valueMap()
==>[name:[marko], age:[29]]
gremlin> g.V().has("name", between("j", "k")).valueMap()
==>[name:[josh], age:[32]]
gremlin> g.V().has("name", between("j", "n")).valueMap()
==>[name:[marko], age:[29]]
==>[name:[lop], lang:[java]]
==>[name:[josh], age:[32]]