-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Is your feature request related to a problem? Please describe.
Given the following type definition as example, a movie can have multiple Genres (e.g ["Action", "Thriller"])
type Movies {
genre: [String]
name: String
}
If I now want to Filter for all Movies that are in a Array of Generes (e.g. ["Horror", "Thriller", "Drama"]), I need to make an Search for each of the generes seperatly, as I can only filter with genre_INCLUDES
or genre_NOT_INCLUDES
, which only filter by an single Argument, not by an array (https://neo4j.com/docs/graphql-manual/current/filtering/#_array_comparison).
Describe the solution you'd like
A better way would be to have an _DISJOINT
and _NOT_DISJOINT
filter, with which two arrays can be compared. If the two arrays have no Elements in common they are disjoint and if they have atleast one in common, they are not disjoint. The names come from set theory: https://en.wikipedia.org/wiki/Disjoint_sets.
With this you could filter for genre_NOT_DIJSOINT: ["Horror", "Thriller", "Drama"]
and would get all Movies where atleast one of these Genres is in common.
Describe alternatives you've considered
The only alternatives are making a request for each of the genres that is searched or creating new Nodes out of these properties (making genre a separate Node) and filtering these seperatly. But this is not possible in all cases (as im currently encountering in a Project). The only real alternative is to build the cypher Query Dynamicly each time and build an construct with with OR and _INCLUDES (e.g. OR: [{genre_INCLUDES: "Horror"}, {genre_INCLUDES: "Thriller"}, {genre_INCLUDES: "Drama"}]
). But this makes everything a bit more complicated and is not very pretty,
I hope the Idea is clear enougth and there is not already a method I overlooked.