Redisgraph: case insensitive order by string implementation

Created on 31 Oct 2019  路  2Comments  路  Source: RedisGraph/RedisGraph

Create Objects:
CREATE (e1:User{name:'One User'}), (e2:User{name:'Two User'}), (e3:User{name:'Three User'}), (e4:User{name:'Four User'}),(e5:User{name:'five User'}), (e6:User{name:'six User'}), (e7:User{name:'Seven User'}), (e8:User{name:'eight User'})
Match using ORDER BY Clause
MATCH (e:User) RETURN e ORDER BY e.name ASC
Response:
e
name:"Four User"
name:"One User"
name:"Seven User"
name:"Three User"
name:"Two User"
name:"eight User"
name:"five User"
name:"six User"

Is it possible to return the result set as case insensitive string instead of case sensitive as obtained above?

cypher question

Most helpful comment

Hi @BhanuPrakash531
you can use tolower or toupper functions
MATCH (e:User) RETURN e ORDER BY tolower(e.name) ASC
returns

127.0.0.1:6379> graph.query g " MATCH (e:User) RETURN e ORDER BY tolower(e.name) ASC"
1) 1) "e"
2) 1) 1) 1) 1) "id"
            2) (integer) 7
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "eight User"
   2) 1) 1) 1) "id"
            2) (integer) 4
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "five User"
   3) 1) 1) 1) "id"
            2) (integer) 3
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Four User"
   4) 1) 1) 1) "id"
            2) (integer) 0
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "One User"
   5) 1) 1) 1) "id"
            2) (integer) 6
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Seven User"
   6) 1) 1) 1) "id"
            2) (integer) 5
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "six User"
   7) 1) 1) 1) "id"
            2) (integer) 2
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Three User"
   8) 1) 1) 1) "id"
            2) (integer) 1
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Two User"

All 2 comments

Hi @BhanuPrakash531
you can use tolower or toupper functions
MATCH (e:User) RETURN e ORDER BY tolower(e.name) ASC
returns

127.0.0.1:6379> graph.query g " MATCH (e:User) RETURN e ORDER BY tolower(e.name) ASC"
1) 1) "e"
2) 1) 1) 1) 1) "id"
            2) (integer) 7
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "eight User"
   2) 1) 1) 1) "id"
            2) (integer) 4
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "five User"
   3) 1) 1) 1) "id"
            2) (integer) 3
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Four User"
   4) 1) 1) 1) "id"
            2) (integer) 0
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "One User"
   5) 1) 1) 1) "id"
            2) (integer) 6
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Seven User"
   6) 1) 1) 1) "id"
            2) (integer) 5
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "six User"
   7) 1) 1) 1) "id"
            2) (integer) 2
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Three User"
   8) 1) 1) 1) "id"
            2) (integer) 1
         2) 1) "labels"
            2) 1) "User"
         3) 1) "properties"
            2) 1) 1) "name"
                  2) "Two User"

Thanks @DvirDukhan

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dandago picture dandago  路  3Comments

abevoelker picture abevoelker  路  5Comments

dandago picture dandago  路  3Comments

m4g005 picture m4g005  路  9Comments

sidenAlex picture sidenAlex  路  3Comments