search for vertices where multiple properties
I need to search for vertices where multiple properties are a certain value.
Here is what I am able to come up with.
This will print out,
The second query is the results I am looking for, but is there a better way to do this?
Using
concat
and filter
is hard to optimize.4 Replies
it can be done with
or
graph.traversal().V().hasLabel("Person").
where(or(has("name", "John").has("surname", "Smith"), has("name", "Jo").has("surname","Do"))).
toList()
Ah thanks, that is a better query.
Thinking a bit more this one however is a little hard coded in the sense that it does not take a collection of sorts. Some kind of specialized
P.within
In my current use case there are thousands of name
, surname
pairs to filter on.if such filtering is needed often, then a possible solution would be to add a field containing both first and last name
Yes, however I am more interested in a general solution.
Something like this maybe?
This messes with the
has
signature, but gives the idea.