algolia / algoliasearch-wordpress

❌🗑🙅‍♂️ Algolia Search plugin for WordPress is no longer supported. Please use our API client guide instead
https://www.algolia.com/doc/integration/wordpress/getting-started/quick-start/
GNU General Public License v2.0
359 stars 115 forks source link

Override current wordpress URL #785

Open lazmo88 opened 6 years ago

lazmo88 commented 6 years ago

What did you expect to happen?

We did static export from our staging version of WordPress and noticed that all indexed items are pointing to the staging installation. We would need the base URL to be dynamic or option to set static base URL via settings/define base URL variable via wp-config.

What happened instead?

Search results are pointing to staging installation.

How can we reproduce this behavior?

Do static export of wordpress site and host it on a different domain.

Can you provide a link to a page which shows this issue? No.

lazmo88 commented 6 years ago

Referring to the docs at https://community.algolia.com/wordpress/migration.html

Ideal solution for us would be to specify fixed base url via constants. Can someone clarify on which class does the url indexing occur?

rayrutjes commented 6 years ago

Hello @lazmo88 . This is unfortunately a behaviour we chose on purpose, because history has shown that it is easier to deal with absolute URLs than with relative ones. Especially when users are re-using the Algolia indices in different contexts which might not necessarily be on the same domain than the current website.

I don't think we want to change this behaviour. It also protects users from mixing staging and production. It often happens that staging does not contain the same data than production. Promoting staging to production would be problematic.

The current way of doing it would be to operate a re-index from production. And making sure the index prefix in prod is different from the one in staging.

lazmo88 commented 6 years ago

Thanks for the response @rayrutjes, unfortunately we can't initiate reindexing from the production site as it's not WP anymore. Just static files.

That said, I noticed autocomplete.js could be one way to manipulate the result URL: https://github.com/algolia/docsearch/issues/104

Do you have any other ideas for achieving this, if you could point us how the indexed URLs are built, maybe we can fork the plugin for internal use :)