WordPress Algolia working with dev, staging & production?

Hi,

So just wondering how I’d go about getting Algolia to work best with a dev, staging and production environment.

Currently, have it setup and working on dev site, but when I push to staging obviously links reference my dev domain. Ideally, I’d like it to just show the production site links but if I add something on my dev site it will upload information not available in production.

Is it possible to work with environments easier?

Ok found these resources which pretty much answers my question

https://www.algolia.com/doc/guides/security/multiple-environments/

However, using constants such as
define( ‘ALGOLIA_APPLICATION_ID’, ‘<your_application_id>’ );
define( ‘ALGOLIA_SEARCH_API_KEY’, ‘<your_search_api_key>’ );
define( ‘ALGOLIA_API_KEY’, ‘<your_api_key>’ );
define( ‘ALGOLIA_INDEX_NAME_PREFIX’, ‘<your_index_name_prefix>’ );

When using with

Will it still require re-indexing?

Hey @Mack,

You only need to re-index the first time you go to production with the Algolia implementation.
Then you need to re-index if you use hooks we provide that changes the ranking or impacts the items being indexed.

If you do not change anything about your indexing, then you do not need to re-index.

Great. Thanks.

Also my staging server has Basic Authentication so when I try to re-index I get an error:

An error occurred: Hosts unreachable:

Any ideas?

I tried whitelisting algolia.com but didn’t work.

The Hosts unreachable error looks more like the scenario where your WordPress could not access Algolia because it doesn’t have network access. In local development for example.

Normally, given requests are done from your browser, it should know how to authenticate you.

Do you have something in your logs maybe?
Can you dig to check if it’s a basic auth issue or if it is an issue contacting Algolia?