简体   繁体   中英

How can I perform a wildcard search on a vertex property in titan graph DB?

I am using blueprints api to query titan graph database. I am in a situation where I need to perform wild card search on a vertex property. Is there a way to query a vertex with its property with a wildcard? something similar to "PropertyName like '%asdf%' " in relational database.

You can read about how to do string-based searches here:

https://github.com/thinkaurelius/titan/wiki/Full-Text-and-String-Search#string-search

In your case you would likely need to use a Text.REGEX based search as you want to evaluate both sides of the string. You would execute this with the Blueprints API using the Query API and would be something like:

graph.query().has("name",Text.REGEX,".*asdf.*").vertices()

在Gremlin v2中我这样做:

g.v.has('name',REGEX,'.*asdf.*').map

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM