Realm Diacritical Insensitive Query Results Using NSPredicate

I use the search box in my application, where the user can enter the product name to filter the items displayed in the view.

I made a query to the Realm database using NSPredicate and looks like this:

let productResults = try ProductDAO.fetchObjects(predicate: NSPredicate(format: "name CONTAINS[cd]%@", pattern))

Im uses modifiers [cd], so the results should be random and diacritical.

It seems to work fine when I type for example:

brazowy

Result:

Cukier brązowy

But when I type a word with a letter L, I could not find any products containing the letter Ł. From the entrance:

"Maslo"

I have to find products such as:

"Masło"

, , Ł. - , - ?

+4

Source: https://habr.com/ru/post/1684735/


All Articles