Search code examples
indexingcase-insensitiveorientdb

How do I create a case insensitive automatic OrientDB index?


I understand that it's supposed to be possible to create a case insensitive automatic OrientDB index through the Collate=CI option, but so far I've been unsuccessful in my attempts at making it work. Nor have I been able to dig up documentation on this feature. I've tried the following index creation command (in the OrientDB console), which works except for the Collate=CI bit:

create index packageByName on Package (name Collate=CI) notunique

What's the correct command for creating this index so that it is case insensitive?


Solution

  • The syntax to create an index with case insensitive (CI) collate is:

    CREATE INDEX <name> [ON <class-name> (prop-names [COLLATE <collate>])] <type> [<key-type>] [METADATA {JSON Index Metadata Document}]
    

    So:

    CREATE INDEX packageByName on Package (name COLLATE CI) notunique