Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a case-insensitive cypher query

Is it possible to run a case-insensitive cypher query on neo4j?

Try that: http://console.neo4j.org/

When I type into this:

start n=node(*)  match n-[]->m  where (m.name="Neo")  return m 

it returns one row. But when I type into this:

start n=node(*)  match n-[]->m  where (m.name="neo")  return m 

it does not return anything; because the name is saved as "Neo". Is there a simple way to run case-insensitive queries?

like image 359
gzg Avatar asked Nov 18 '12 10:11

gzg


People also ask

Is neo4j case sensitive?

Yes, property values are case sensitive.

Does Cypher use Ascii art to perform queries?

The Cypher query language depicts patterns of nodes and relationships and filters those patterns based on labels and properties. Cypher's syntax is based on ASCII art, which is text-based visual art for computers.

WHAT IS WITH clause in Cypher?

The WITH clause allows query parts to be chained together, piping the results from one to be used as starting points or criteria in the next. It is important to note that WITH affects variables in scope. Any variables not included in the WITH clause are not carried over to the rest of the query.

What does collect do in Cypher?

collect() The function collect() returns a single aggregated list containing the values returned by an expression. Returns: A list containing heterogeneous elements; the types of the elements are determined by the values returned by expression . An expression returning a set of values.


1 Answers

Yes, by using case insensitive regular expressions:

WHERE m.name =~ '(?i)neo' 

https://neo4j.com/docs/cypher-manual/current/clauses/where/#case-insensitive-regular-expressions

like image 144
Volker Pacher Avatar answered Oct 15 '22 00:10

Volker Pacher