How to render the main store algolia search in all the store

We are using Magento 2.2.2 Enterprise Edition.

We have one website, five stores and each store have one store view.

  1. We enabled the algolia for the main store called “store1”
  2. We disabled the algolia index via admin in all other stores (store2, store3, store4, store5)

the question is how to display the “store1” algolia search in “store2, store3, store4, store5”, since we are using same product sets for all the stores.

Hello @markmcnatt,

the solution would be to disable indexing on stores 2-5, but keep the searching enabled.
Then you’ll need to use algolia_after_create_configuration backend hook to modify frontend Algolia configuration to use the same index names (of store1 indices) on all the stores. That will make sure the indices from store1 will be targeted.

What will be an issue there is that product URLs will always target store1 and not the store you’re searching on. To fix that, you’ll need to extend transformHit function to change URL attributes of the records to contain the correct URL.

We follow the below steps as per your reply

  1. disable indexing on stores 2-5
  2. keep the searching enabled on stores 2-5
  3. Index Name Prefix same for all the store

Now, Magento frontend renders default Magento search instead of algolia search.

If we did anything wrong, please let us know.

Hello @markmcnatt,

it’s not about index prefix in Algolia configuration in Administration, but about the same index name which needs to be set with the hook. Did you do it?
Can you share your store with me where I could investigate it live?