Static Search Parameter

In our index, we have about 10,000 products. Each of those products has an attribute called “SiteID” that is one of about 100 values. (For example, 100 products have a SiteID of 100, 200 Products have a SiteID of 101, 100 products have a SiteID of 102, etc.)

Based on the site that a user is associated with, we set a global JS (and PHP) variable on our pages for SiteID. What I want to do is pass this SiteID to our instantsearch as a filter (?) so that the user is only returned items from the index that have SiteID matching to the user’s specific SiteID. I don’t want this filter to show up as user-changeable (in a facet list or anyplace else). What is the best way to do this?

As a side note, no, we cannot make a separate index for each subset of products based on SiteID. All the products must remain in the same index.

Thanks for any quick help you can provide! Our developer had come up with a way of using API Keys (User-Restricted Access to Data | How to | Security | Guide | Algolia Documentation) to do this, but it seems to me there must be a simpler way.

So … you want user X Y Z to only search in subset where siteID = A
and user K L M in subset where siteID = B ?

where A and B are numbers.

Try pre-filtering, that allows the very same source index but filters based on your input which you can dynamically set up.