I am trying to make search field in my app, I am using startAt and endAt methods. These methods work very well without case sensitivity. But, unfortunately it doesn't work properly with incase sensitivity.
let startText = searchText.toUpperCase();
let endText = searchText.toLowerCase()
const productRef=db
.collection("products")
.orderBy(searchField)
.startAt(startText).endAt(endText+"\uf8ff");
Assume I have ["a", "A", "AB", "ABC", "Z", "a"] If I search "AB" it only sorts the data only, it retrieves "AB", "ABC", "Z", "a" Or if I search "z" it retrieves "Z", "a", "z"
Am I doing something wrong or this method actually doesn't work?
I have seen people keeping lowercase versions of fields in the document, is this the only way of solving the problem?
name:"Overflow" nameLower:"overflow"