cypher query order by lower case

175 views
Skip to first unread message

Harbhajan

unread,
May 4, 2012, 3:27:57 PM5/4/12
to Neo4j
I am trying to sort a query that matchs first and last name buy first
name and last name. first name can be capitalize or could be all lower
case. I wanted to covert first name + last name to lower case before
it sort.

Example: Currently I query looks like this:

"start n=node(%d) match n-[:MEMBERSHIP]->m<-[:MEMBERSHIP]->u where
(u.firstName =~/(?i)%s.*/ or u.lastName =~/(?i)%s.*/) %s return u
order by u.firstName, u.lastName limit %d"


I want to able to do something like this:
"start n=node(%d) match n-[:MEMBERSHIP]->m<-[:MEMBERSHIP]->u where
(u.firstName =~/(?i)%s.*/ or u.lastName =~/(?i)%s.*/) %s return u
order by u.firstName.lowercase, u.lastName.lowercase limit %d"

Michael Hunger

unread,
May 4, 2012, 6:39:00 PM5/4/12
to ne...@googlegroups.com
I think it would make sense to add functions like lowercase and uppercase to cypher which you then could use for this. Right now it is not possible.

There is already a ticket for this: https://github.com/neo4j/community/issues/334

Btw. please not that you will not get cypher query caching performance bonus b/c you don't use parameters.

see: http://docs.neo4j.org/chunked/snapshot/cypher-parameters.html
Reply all
Reply to author
Forward
0 new messages