Search code examples
neo4jcypherstring-concatenation

string concatenation in Cypher Neo4j


I want to achieve this: retrieve a word from a CSV file, then look for the existence of a hashtag with the word in a post the problem is that I was unable to perform the concatenation


Solution

  • The "Type mismatch" error could be solved by enclosing the concatenation in parentheses, as in:

    WHERE line[0] =~ (".*#" + line[0] + ".*")
    

    However, logically, that WHERE clause can never be true. A string cannot be equal to a longer string (itself, preceded by an extra character).

    If you just trying to see if a word starts with a hashtag, this should work:

    WHERE line[0] STARTS WITH "#"
    

    Or, if you want to see if there is a hashtag in the string:

    WHERE line[0] CONTAINS "#"