ORDER BY not sorting alphabetically


Using both OrientDB Studio and the Java API, when I perform the following query

select * from `VPerson` order by name asc limit 25 skip 0

I get strange results. At first glance, the records returned looked fine but then I noticed that some records were not sorted correctly. For instance, I have values starting with “AM” before “AL” and in one case a value starting with “c” ends up in the very last position after the Zs !

The problem is the same if I remove the limit and skip.

I should mention that the Vertex class in question is schema-less (no properties or indexes).

Any ideas?



It seems this is due to the way OrientDB handles capitalisation. So I need to do something like:

select * from `VPerson` order by name.toLowerCase() asc limit 25 skip 0

Which is a tad cumbersome given that I’m building these queries dynamically.

Anyone know if there’s an alternative ?