Case.INSENSITIVE query broken at 3.1.3
See original GitHub issueIt appears that case-insensitive queries are broken in some cases.
It appears that if you have a field with the same string in different cases, querying on the field in a case-insensitive manner returns no results, rather than the expected two results.
This behaviour was working in 3.1.2 but broke in 3.1.3. I suspect this may have been due to a change to realm core. It is still broken as of 3.3.2.
See the Repo here with a failing test: https://github.com/51systems/RealmBugs
The following test fails:
realm.beginTransaction();
Dog dog1 = realm.copyToRealm(Dog.create("ROVER"));
Dog dog2 = realm.copyToRealm(Dog.create("Rover"));
realm.commitTransaction();
assertThat(realm.where(Dog.class).equalTo("name", "ROVER", Case.SENSITIVE).findAll(),
containsInAnyOrder(dog1));
assertThat(realm.where(Dog.class).equalTo("name", "Rover", Case.SENSITIVE).findAll(),
containsInAnyOrder(dog2));
//Fails here
assertThat(realm.where(Dog.class).equalTo("name", "rover", Case.INSENSITIVE).findAll(),
containsInAnyOrder(dog1, dog2));
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
EF core string case sensitivity not working - Stack Overflow
To get your query to work properly don't try to force the case or the collation. Just use a simple equality : var...
Read more >5 Linguistic Sorting and Matching - Oracle Help Center
Case-Insensitive and Accent-Insensitive Linguistic Collation ... in such a way that values entered by one user cannot break queries issued by another user....
Read more >Collations and case sensitivity - EF Core - Microsoft Learn
Configuring collations and case-sensitivity in the database and on queries with Entity Framework Core.
Read more >Why are URLs case-sensitive? - Webmasters Stack Exchange
URLs are not case-sensitive, only parts of them. For example, nothing is case-sensitive in the URL https://google.com ,.
Read more >How-To: Case-Insensitive Searches - Humio Documentation
This work-around resolves the problem for a single query; you'll have to use this method for each query for which you want case-insensitive...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Zhuinden you are fast … This is fixed in
3.5.0
.You might be correct, there was an optimization a while ago that ended up in a deadlock when the string contained only numbers and the search was case-insensitive on an indexed field, maybe this is also a side-effect of said optimization and is most likely a bug, see https://github.com/realm/realm-core/pull/2578#issuecomment-297844618
@danielpovlsen
Nice find by the way