question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Case.INSENSITIVE query broken at 3.1.3

See original GitHub issue

It 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:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
beeendercommented, Jul 11, 2017

@Zhuinden you are fast … This is fixed in 3.5.0.

1reaction
Zhuindencommented, Jun 15, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found