within() and case insensitive

I need to check if a property of a node is in a list of values. How can I do that in a case insensitive manner? has('name',within('vadas','josh')) (+ case_insensitive?) I can do that naughty step : filter{ it.get().values('name').toLowerCase() in ['vadas', 'josh']; } I guess I can also duplicate that 'name' and make another property with the lowercase version of 'name' so within works. Any other suggestion?
Solution:
TextP.regex can be used, something like g.V().has("name", TextP.regex("(?i)^(vadas|josh)$"))...
Jump to solution
3 Replies
Solution
Valentyn Kahamlyk
TextP.regex can be used, something like g.V().has("name", TextP.regex("(?i)^(vadas|josh)$"))
kelvinl2816
kelvinl281615mo ago
I think it's also worth adding that fairly soon the number of built in string manipulation functions that Gremlin supports will be increased and among those will be functions that support case insensitive operations. For right now, without falling back to closures, the regex step probably is the one to look at.
Dseguy
DseguyOP14mo ago
Sounds good. Thanks to both of you.
Want results from more Discord servers?
Add your server