String query with StringComparison.OrdinalIgnoreCase


Is there an expression to query StringComparison.OrdinalIgnoreCase in a string query or do I just have the syntax wrong?

var dogs = ArrRealm.All().Subscribe();
string QueryString = “ IKE '(” + search_terms + “*, false)’”;
return dogs.Results.Filter(QueryString).Subscribe();


I think there’s some misconception about how subscriptions work here. There’s no need to subscribe multiple times for a subset of the objects - once you subscribe to all dogs, subscribing for a smaller subset is redundant. That being said, I’d need to see the precise query you’re generating. I’m not sure what IKE is supposed to mean here, but it’s not supported by the query engine. You can check out the string operators in the docs.


Yes, I should call Subscribe once and the query returns correctly as documented when querying a single object. In this example bowl is To-Many.

This returns correctly when search terms are correct case.

var query = realm.All().Where(q => q.user_id == User.Current.Identity).Subscribe();
string QueryString = “ LIKE '” + search_terms + “*’”;
return query.Results.Filter(QueryString).Subscribe();

This returns nothing and does not throw an exception?

string QueryString = “ LIKE ‘(" + search_terms + "*, false)’";


Per the docs I linked, the syntax you’re using for LIKE is incorrect - it doesn’t need brackets and the , false is not recognized by the query engine. If you want the search to be case insensitive, pass LIKE[c]. The exception is thrown not when calling subscribe, but rather when awaiting the results of the subscription - I would expect an error pointing to an invalid query.


Thanks! I was looking here: and following the tool tip.


The LINQ docs are valid only when using LINQ for filtering, whereas you are using the string-based syntax.