Cypher OrderBy Case Insensitve

474 views
Skip to first unread message

kantube

unread,
Mar 13, 2012, 12:03:50 PM3/13/12
to ne...@googlegroups.com
is there a way to make the Cypher OrderBy be case insensitive? 

Peter Neubauer

unread,
Mar 13, 2012, 2:17:33 PM3/13/12
to ne...@googlegroups.com
I don't think you can do that right now. Is there a SQL matching
keyword for that?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.6 released                 - dzone.com/6S4K
The Neo4j Heroku Challenge   - http://neo4j-challenge.herokuapp.com/

kantube

unread,
Mar 13, 2012, 6:55:07 PM3/13/12
to ne...@googlegroups.com
there are two things that come to mind in sql

one is the COLLATE that is applied to the DB or Column.  with COLLATE SQL_Latin1_General_CP1_CI_AS strings are case insensitive

the other is the LOWER function.  you can use the LOWER(myCol) in the OrderBy clause. 


Andres Taylor

unread,
Mar 14, 2012, 2:02:07 AM3/14/12
to ne...@googlegroups.com
On Tue, Mar 13, 2012 at 11:55 PM, kantube <mic...@mkanner.com> wrote:
there are two things that come to mind in sql

one is the COLLATE that is applied to the DB or Column.  with COLLATE SQL_Latin1_General_CP1_CI_AS strings are case insensitive

Sure, this makes sense. It's not on the radar right now (this is a big job), but it makes sense.

the other is the LOWER function.  you can use the LOWER(myCol) in the OrderBy clause. 

 This on the other hand, should be fairly easy to do. I opened a ticket for it, so you can track when it's done: https://github.com/neo4j/community/issues/334

Thanks for the feedback!

Andrést

kantube

unread,
Mar 14, 2012, 10:46:29 AM3/14/12
to ne...@googlegroups.com
Andres,

if you do the LOWER function would you also be able to use it as a filter to Lucene to make indexed searches case insensitive.  i brought this up in another post
https://groups.google.com/forum/?fromgroups#!topic/neo4j/MA7s6umhISM
and created a ticket for it as well
https://github.com/neo4j/community/issues/326

I know that what i am asking for with Lucene is at the DB level but it does tie into this string case sensitivity

I understand that the COLLATE would be a "big job" - but it would be a great solution! if you were able to tie it in with Lucene at the same time (don't even know if that would be possible) that would be great.  it would also solve some other sorting issues that i have seen other users ask on the form (someone asked about sorting chinese characters).

Thanks
Michael

Andres Taylor

unread,
Mar 14, 2012, 11:48:02 AM3/14/12
to ne...@googlegroups.com
On Wed, Mar 14, 2012 at 3:46 PM, kantube <mic...@mkanner.com> wrote:
I understand that the COLLATE would be a "big job" - but it would be a great solution! if you were able to tie it in with Lucene at the same time (don't even know if that would be possible) that would be great.  it would also solve some other sorting issues that i have seen other users ask on the form (someone asked about sorting chinese characters).

Although this is very interesting, I think that given our current work load and plans, the best recommendation I can give you is to find other ways around your problem.

Sorry, but that's the reality I see.

Andrés

Peter Neubauer

unread,
Mar 14, 2012, 11:57:52 AM3/14/12
to ne...@googlegroups.com
Also,
I think this should be solved in the indexing system rather than
Cypher at the moment, otherwise the query language will be hard-tied
to Lucene as the backend which is not what we want. So, we should
think of ways to make this more flexible at the index provider level.

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.6 released                 - dzone.com/6S4K
The Neo4j Heroku Challenge   - http://neo4j-challenge.herokuapp.com/

Andres Taylor

unread,
Mar 14, 2012, 12:30:55 PM3/14/12
to ne...@googlegroups.com
On Wed, Mar 14, 2012 at 4:57 PM, Peter Neubauer <peter.n...@neotechnology.com> wrote:
Also,
I think this should be solved in the indexing system rather than
Cypher at the moment, otherwise the query language will be hard-tied
to Lucene as the backend which is not what we want. So, we should
think of ways to make this more flexible at the index provider level.

Ordering in Cypher does not use indexes, so it probably needs more work than just in the indexing system. Like I said - it's a big change that will likely affect core, Cypher and indexes, to start.

Andrés

 

kantube

unread,
Mar 14, 2012, 1:35:51 PM3/14/12
to ne...@googlegroups.com
i may have stated this incorrectly.  i was thinking that you have a neo4j config setting that would set the COLLATE type.  with this knowledge neo4j would inform the Lucene index (or other indexing) of what collate type to use (if even possible).  and i am sure that this is a big update.

Michael Hunger

unread,
Mar 14, 2012, 4:20:52 PM3/14/12
to ne...@googlegroups.com
It would probably be easier to intro a tolower function in cypher.

order by tolower(n.name) desc

For now keep a separate field with the lc value

Von meinem iPhone gesendet

Reply all
Reply to author
Forward
0 new messages