Ola
Ola

Reputation: 431

How can searching with each user's firebase uid be implemented in Algolia's instantsearch?

enter image description here

I indexed my firebase database to Algolia. What I want to do now is allow each user to search only within their own inventory.

I indexed all the firebaseDB to "Business" in Algolia. These are some references from my index.js for Algolia.

  //configure algolia
     var index = algolia.initIndex('Businesses');

      var businessRef = database.ref("/Businesses");


       businessRef.on('child_added', addOrUpdateIndexRecord);
       businessRef.on('child_changed', addOrUpdateIndexRecord);
       businessRef.on('child_removed', deleteIndexRecord);

I was able to implement instant search and autocomplete. However only Author, Businessname, email and website are searchable. inventory and everything in it are not searchable. How can I fix this and How can I implement searching within each users inventory?

Upvotes: 0

Views: 106

Answers (1)

Baptiste C
Baptiste C

Reputation: 56

I would recommend generating secured API key for each user :). We have a good tutorial that explains what you should do: https://www.algolia.com/doc/tutorials/security/api-keys/secured-api-keys/how-to-restrict-the-search-to-a-subset-of-records-belonging-to-a-specific-user/

Let me know if this helps !

Upvotes: 1

Related Questions