I need to find customers from Realm Db based on first and last name. Currently, I have a query like this:
RealmResults<CustomerModel> results = realm
.where(CustomerModel.class)
.or()
.contains("firstname", input, Case.INSENSITIVE)
.or()
.contains("lastname", input, Case.INSENSITIVE)
.or()
.contains("addresses.street", input, Case.INSENSITIVE)
.or()
.contains("addresses.city", input, Case.INSENSITIVE)
.or()
.contains("addresses.postcode", input, Case.INSENSITIVE)
.findAllSorted("customerLocalId", Sort.DESCENDING);
This does not work properly since I have OR between first and last name.
So, if I want to find user named John Doe, it wont find it, but if I type only John it will find it.
How I can solve this?