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:Jump to solution
TextP.regex
can be used, something like
g.V().has("name", TextP.regex("(?i)^(vadas|josh)$"))
...3 Replies
Solution
TextP.regex
can be used, something like
g.V().has("name", TextP.regex("(?i)^(vadas|josh)$"))
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.Sounds good. Thanks to both of you.