The api key generated via Algolia::searchKey is too restrictive, it only includes the primary index in its restrictIndices array. When using replicas for sorting with that key it fails, because the replicas are not included. This happens when sending the (secured) search key to a frontend javascript that only has one api key.
This change loads the replicas setting from the associated index config file and appends that to the restrictIndices.
There is probably a better way to load the config, I didn't dive that deep in the code. Perhaps it should be loaded from the remote index instead of via the local synced config file?
The api key generated via
Algolia::searchKey
is too restrictive, it only includes the primary index in itsrestrictIndices
array. When using replicas for sorting with that key it fails, because the replicas are not included. This happens when sending the (secured) search key to a frontend javascript that only has one api key.This change loads the
replicas
setting from the associated index config file and appends that to therestrictIndices
.There is probably a better way to load the config, I didn't dive that deep in the code. Perhaps it should be loaded from the remote index instead of via the local synced config file?