Short question:
Is there a way to tell CoreData to use COLLATE when creating an INDEX?
Detailed explanation:
I need to display a list of clients in a case insensitive list by name. The "name" field is marked for INDEXING in xCode. I use the following sort descriptor:
sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
This leads to the following query from CoreData. All is good so far.
SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZNAME FROM ZCLIENT t0 WHERE t0.Z_PK IN (?, ?, ?) ORDER BY t0.ZNAME COLLATE NSCollateLocaleSensitiveNoCase LIMIT 20
But if I look at the INDEX created by CoreData, it does not use COLLATE when creating the INDEX. This would mean that all case-insensitive queries would be slow for a large dataset.
CREATE INDEX ZCLIENT_ZNAME_INDEX ON ZCLIENT (ZNAME)
Is there a way to create an index based on COLLATE? Is there a way to specify this in xCode?
siasl source share