How to check the node exists when the property type is array?

Hi,
How do you check existence of the node if the property is type of array?

Before, I set the Product node's "vertical" property is 'string' type.
so I used like query below

match (w:Word)-[:SEARCH]->(c:Category)
with c
with collect(c)[0..5] as cs
return any(cat in cs where exists((cat)-[:INCLUDE]->(:Product {vertical: 'DEP'}))) as flag1,
any(cat in cs where exists((cat)-[:INCLUDE]->(:Product {vertical: 'OUT'}))) as flag2

but now, 'vertical' property is array type.
and this is impossible way :thinking: (it's obvious)
any(cat in cs where exists((cat)-[:INCLUDE]->(:Product {'DEP' in vertical}))) as flag1,
any(cat in cs where exists((cat)-[:INCLUDE]->(:Product {'OUT' in vertical}))) as flag2

example query is the part of the whole cypher..
so I have to care about the cost of the cypher.
Please comment if you have any good idea

Thanks
Leila

@danbi5228

I think that the following statement should be fine (I changed collect(c)[0..5] with WITH c LIMIT 5 and I collected vertical properties so that I can check only this property ):

MATCH (w:Word)-[:SEARCH]->(c:Category)
WITH c LIMIT 5 // only 5 nodes
MATCH (c)-[:INCLUDE]->(p:Product) // match products
WITH collect(p.vertical) as verticals // collect verticals
RETURN any(vert in verticals where "DEP" in vert), any(vert in verticals where "OUT" in vert)
1 Like

Thank you @giuseppe_villan !
I solve it thanks to your statement ;)