How Gremlin query same sql like for search feature

Minh Loc picture Minh Loc · Sep 30, 2013 · Viewed 8.9k times · Source

Im using OrientDB type graph. I need syntax of Gremlin for search same SQL LIKE operator

LIKE 'search%' or LIKE '%search%'

I've check with has and filter (in http://gremlindocs.com/). However it's must determine exact value is passed with type property. I think this is incorrect with logic of search.

Thanks for anything.

Answer

Daniel Kuppitz picture Daniel Kuppitz · Sep 30, 2013

Try:

g.V().filter({ it.getProperty("foo").startsWith("search") })

or

g.V().filter({ it.getProperty("foo").contains("search") })