I'm trying to implement a search bar for my website that uses Firebase as its database. It's a bunch of links to certain images and embed videos. I'm thinking is it best to have a "tag" field for each link, that the lunr library would query for? I'd split each tag field into an array of strings and the lunr would look for each one?
My database has the JSON format of:
{ "Featured" : {
"Link1" : {
"isEmbed" : false,
"priority" : 4,
"url" : "https://s3.amazonaws.com/hagshs8282n23/image7.jpg",
"tag" : nba nfl nhl mlb yahoo
},
"Link2" : {
"isEmbed" : false,
"priority" : 3,
"url" : "https://s3.amazonaws.com/hagshs8282n23/image6.jpg",
"tag" : fire base stuff art cool
} }
Is this a slow way to go about searching for objects or is there a better way to think about it?
Alternatively, I was thinking that whenever a file is added to the database, I would export that new JSON structure to a folder in the home directory of the website (/dir/ or something like that) and then have lunr read from that instead of Firebase. Would that be quicker since the files would be local and not in Firebase or would it not make a difference?