0

I have a property on the node which is stored as array of strings. But when I use this field to find the node, it's not returning any results. What am I doing wrong?

Below is the node:

MATCH (n:Product)
WHERE
n.id_product = 8
RETURN
n.keyterms

Result

["financial tool", "personal finance"]

I am trying to find the same node as above using the keyterms field:

MATCH (n:Product)
WHERE
["financial tool"] in n.keyterms
RETURN
n.keyterms

no records
Taja Jan
  • 942
  • 1
  • 1
  • 11
Tom
  • 86
  • 1
  • 10

1 Answers1

1

You don't have to put "financial tool", in an array, simply try this:

MATCH (n:Product)
WHERE "financial tool" in n.keyterms
RETURN n.keyterms

To search for, multiple values, you can do the following:

MATCH (n:Product)
WHERE ANY (key IN n.keyterms WHERE key IN ['financial tool', 'personal finance'] )
RETURN n.keyterms
Charchit Kapoor
  • 8,934
  • 2
  • 8
  • 24
  • Thanks, that worked. How about searching for multiple values? "financial tool" or "personal finance". Any option to do that in a single where clause? – Tom Jan 11 '23 at 05:47