You can provide partial search [ type ahead facility ] with firestore. It's not that much streight forward and also not feasible in case of large amount of data that has to support the partial search.
Here is just a sample of how you provide partial search with firestore.
Logic behind the search is a custom kind of indexing that enables partial search for us. You need to create a collection of documents called indexes which contains indexes generated for the fields you want to search over.
First reqirement is to create every possible partial search strings.
Below function returns array of the possible indexes generate after chopping out input string character by character.
Output of _chopped_object(manish) will be,
That's what we want, Right !
We want tha if we write "m..." it should know we may want to write "manish"
Next question is how to store this index and use it with firebase project.
Create a sperate collection called searchables ( I am saying it searachables 😀, you are free to say anything man ), and store these index documents inside it.
It may be that it's some confusing, how to use this code.
We have dictonary of Persons, It includes details like name,phone,email,address
This is our document we are storing in collection of persons
We want to create searchable index of field of name.
Means, If, I type "m" I should get suggetion of "manish" and "mchampaneri" and after "ma" it should just suggest "manish" 👍.
In this case,
when you store the person details in document you can create a searchable index in same process.
If you see your serachables documents you will find data look like somthing this
here is example code for search box ..
Upper code will just try to read the property [value] of the object searchables_index and will get true if it exist.
Hope this was easy to understand.
If it's not clear, let me know!
Have a great day !