I am currently trying to enhance the search functionality in my firebase database to enable users to easily locate the product they are looking for.
My current approach involves matching the search query, stored in this.searchText, with the product titles in the firebase database.
return str.filter((product) => {
return product.title.match(textSearch)
})
However, I have encountered a challenge:
When dealing with a database containing a large number of products, filtering through all of them on the front-end seems inefficient. It would be more effective to implement a targeted query such as:
firebase.database.ref('products').containing('leather shoe')
Unfortunately, I have not yet found a suitable solution to address this issue.