Additional query parameter

Hello,

I am trying to implement a feature to our search…

The objects within the index looks like so:

{
objectID: …,
ownerEmail: …,
name: …,

}

We want to allow users to search only the objects which they own… that is, where the ownerEmail == currentUserEmail (a variable within the component).

How do I pass this additional info in each search.

We are using angular.

Thanks
Eric

Hello ecoffman,

  • Algolia API allows anyone with the right params to find what they want on your index,
    if you do it in the backend it’s more secure but if your search is on the frontend this is not secure because nothing prevents your user to modify or replay your fetch to Algolia .
    If you want to enforce a restricted search on the frontend we recommend to use Secured API Key
    This is the best way to restrict a certain scope for each users.
    https://www.algolia.com/doc/guides/security/api-keys/#secured-api-keys-virtual

  • To answer your initial question, to filter a search to a certain scope you just need to use Filtering

Best regards