cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Changing the type from StringArray to String using cypher

Hello everyone,

I want to make the following query but I get an error because of the type of f.synonyms (it is a StringArray):

MATCH (f:Family)-[:IS_PROVIDED]->(p:Provider)-[:OFFERS]->(pr:Product)

WHERE (f.name =~ '(?i)virtual server(?i).')
OR (toLower(f.name) CONTAINS toLower('virtual server'))
OR (f.synonyms =~ '(?i)virtual server(?i).
')
OR (toLower(toString(f.synonyms)) CONTAINS toLower('virtual server'))

RETURN DISTINCT f.name AS Family

Is there any way how to change the type from StringArray to String in order to check if some phrase is contained or not???

2 REPLIES 2

intouch_vivek
Graph Steward

Hi @busymo16,

Hope by StringArray you do not mean list. so example of StringArray is 'virtual server'
What kind of data you have in f.synonyms?
Are you just trying to find all the family for which f.name or f.synonyms contains 'virtual server'.

If by StringArray you mean a list of strings, then you can use predicate functions to test if any, all, or none of the elements in the list contains the phrase:

OR any(syn IN f.synonyms WHERE toLower(syn) CONTAINS 'virtual server')