Search code examples
azure-cosmosdbgremlin

Azure Cosmos DB Graph Wildcard search


Is it possible to search Vertex properties with a contains in Azure Cosmos Graph DB?

For example, I would like to find all persons which have 'Jr' in their name?

g.V().hasLabel('person').has('name',within('Jr')).values('name')

Seems like the within('') function only filters values that are exactly equal to 'Jr'. I am looking for a contains. Ideally case insensitive.


Solution

  • The Azure team has now implemented Tinkerpop predicates for String

    The Azure team has "announced" this to a user here on their feedback website.

    I haven't tested all of them, but containing works for me (it is case sensitive though)

    g.V().hasLabel('doc').or(__.has('title', containing('truc')), __.has('tags', containing('truc')))
    

    TextP.startingWith(string)

    Does the incoming String start with the provided String?

    TextP.endingWith(string)

    Does the incoming String end with the provided String?

    TextP.containing(string)

    Does the incoming String contain the provided String?

    TextP.notStartingWith(string)

    Does the incoming String not start with the provided String?

    TextP.notEndingWith(string)

    Does the incoming String not end with the provided String?

    TextP.notContaining(string)

    Does the incoming String not contain the provided String?