You don't have to download the entire DB for this (i assume you'r using realtime database over firestore).
You can filter your data mixing orderByChild()
or orderByKey()
or orderByValue()
with query methods like startAt()
, endAt()
and equalTo()
.
For example, if your list of nodes url is
https://mydb-xxxx.firebaseio.com/parentnode/childnodeslist
You can query in this way:
// Find all nodes whose property myString is "hello"
var ref = firebase.database().ref("parentnode/childnodeslist");
ref.orderByChild("myString").equalTo('hello').once(‘value’).then(function(element){
console.log(element);
});
see the query doc and how to structure your data in firebase
EDIT: BASED ON COMMENTS:
If you want to make a full text search you can:
1) Make it client side
// assume "myString" is your param name
var word = 'hello';
var listOfItems = [];
firebase.database().ref("parentnode/childnodeslist").then(function(list){
listOfItems = list.map(function(item){
if( item.myString.indexOf(word) >= 0){
return {id: item.id, word: item.myString}
}
})
})
2) Use a third party tools like ElasticSearch (as suggested by @Frank-van-Puffelen) or Algolia
3) Use Cloud Functions