I have database with labels:Theme and:Term. Terms related to themes. I need filter for terms by themes with AND feature. It`s will be like this: i`m choosing couple of themes, and geting terms with these all themes. I`m sending ids of themes.
I`ve tryed this query:
MATCH (n:Term)-->(t:Theme)
WHERE id(t) IN [1, 2, 3]
RETURN n
But it`s OR logic. I need AND logic.
WITH [1,2,3] as inputThemes
MATCH (t:TERM)-->(th:THEME)
WHERE id(th) in inputThemes
WITH t, size(inputThemes) as inputCnt, COUNT(distinct th) as matchedCnt
WHERE inputCnt= matchedCnt
RETURN t
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.