0

https://example.com/foods.json?orderBy="title"&startAt="Yoğurt"&endAt="Yoğurt\uf8ff"

With the above link, I can search the data in Firebase Realtime Database Rest Api using startAt, endAt query parameters.

How can I find the results when searching with similar special characters?

For example, yoğurt and yogurt, kızartma and kizartma

I want to get the same result when written both ways.

If this is not possible with Firebase, is it possible with String methods in Javascript or Dart programming language?

Gurkan T
  • 198
  • 2
  • 14

1 Answers1

0

There is nothing built into Firebase for performing this type of search, so you will have to do your own work to allow it.

The simplest way is to store a secondary value for each string that you want to search, where you map each character back to a single representative value you want to search on.

A very common mapping is for example to map all text to a single case (uppercase or lowercase) so that searches become case-insensitive. You can do similar for the accented characters, mapping the ğ to g. So by combining these two tricks, Yoğurt becomes yogurt.

Same for the ı you show (and İ), mapping all four I variants in the Turkish alphabet to i.

Doing this for all special characters gives you a single string value (in addition to the user input, which you should also still store) that you can use for searches.

For more on this, I recommend also reading Dan's answer here.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807