Basically I am writing a search function on a Firestore document field. I want to write equivalent of below SQL. I am not finding solution to proceed.
SELECT * FROM employee WHERE lower(employee_name) LIKE '%johny%';
Basically I am writing a search function on a Firestore document field. I want to write equivalent of below SQL. I am not finding solution to proceed.
SELECT * FROM employee WHERE lower(employee_name) LIKE '%johny%';
There is no like operator. See all available operators at: https://firebase.google.com/docs/firestore/query-data/queries The page also contains different ways on querying the database.
For case insensitive sorting / querying please see the answer at Cloud Firestore Case Insensitive Sorting Using Query
It basically advises to store your lowercase data in an additional field.
https://firebase.google.com/docs/firestore/solutions/search
As Norman already wrote, there is no LIKE operator in Firebase.
I wrote an answer in SO that explains how to achieve a similar query (even if it is a StartWith search, rather than a full text search):
If you need more advanced ways of searching, then the advice is to use ElasticSearch, as a possible solution.