objectbox-java
objectbox-java copied to clipboard
CASE_INSENSITIVE string query does not work with Cyrillic language
Issue Basics
- ObjectBox version (are using the latest version?): 2.3.4
- Reproducibility: always
Reproducing the bug
Description
When querying db by string pattern in Russian case sensitivity option does not work. E.g given name "Андрей", case insensitive query "андрей" will fail to find it.
Code
orderDesc(Message_.timestamp)
.startsWith(Message_.dialogId, it.dialogId).and()
.contains(
Message_.body,
pattern,
QueryBuilder.StringOrder.CASE_INSENSITIVE
)
Entities
@Entity
data class Message(
@Index val uuid: String = newUuid(),
val body: String = "",
val dialogId: String = "",
var timestamp: Long = TimeSync.time,
...
)
As far as I know ordering by case only supports ASCII characters. This is also indicated by the docs. http://objectbox.io/files/objectbox-java/current/io/objectbox/query/QueryBuilder.html#CASE_SENSITIVE http://objectbox.io/files/objectbox-java/current/io/objectbox/query/QueryBuilder.html#order-io.objectbox.Property-int-
-Uwe
As far as I know ordering by case only supports ASCII characters. This is also indicated by the docs. http://objectbox.io/files/objectbox-java/current/io/objectbox/query/QueryBuilder.html#CASE_SENSITIVE http://objectbox.io/files/objectbox-java/current/io/objectbox/query/QueryBuilder.html#order-io.objectbox.Property-int-
-Uwe
I am not concerned about ordering but rather about searching and finding an item.
@greenrobot-team ordering can be dropped to reproduce issue.
@arnis71 Sorry, I misread. But the same applies for a contains-query. Case sensitivity currently only works on the ASCII character set. http://objectbox.io/files/objectbox-java/current/io/objectbox/query/QueryBuilder.StringOrder.html#CASE_INSENSITIVE
-Uwe
Seriously need case sensitivity covering at least extended ascii characters. As it stands now, not only Cyrillic, but German, French, Spanish, Italian don't work fully (given the accent letters).
Just to note this here as well: a workaround is to add another property for searching and store the original value with diacritics removed and case mapped in whichever way is suitable for your use case.
Related issues: #46, #499, #806 - not sure if we need those three and this one to track it.
Moving the discussion about improving support for other languages to #46.