Issue
I need to search and filter from the Firestore collection. A sample collection with the name "products" is given below.
[
{
"id": 1,
"name": "product 1",
"description": "product description 1",
"categoryId": 35,
"categoryName": "Category 123",
.......
},
{
"id": 2,
"name": "product 2",
"description": "product description 2",
"categoryId": 44,
"categoryName": "Category 72",
.......
}
]
For example, if I entered a search text, I need a result from the Firestore collection where any of the fields contains a full or partial portion of the search text. Also, each product contains manufacturing and expiry dates. So I need to filter between a date range.
Solution
Partial text search is not a supported feature with Firestore, it uses a direct comparison for values.
You will have to implement a custom search feature yourself by 3rd party API like Algolia with cloud functions or create a breakdown of all the text in strings that support broken down letter combinations - but this can increase reads unwantedly and I do not recommend it.
Answered By - DIGI Byte
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.