algoliasearch-wordpress icon indicating copy to clipboard operation
algoliasearch-wordpress copied to clipboard

Override current wordpress URL

Open lazmo88 opened this issue 6 years ago • 3 comments

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 avatar Aug 27 '18 17:08 lazmo88

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?

lazmo88 avatar Aug 27 '18 23:08 lazmo88

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.

rayrutjes avatar Aug 28 '18 07:08 rayrutjes

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 :)

lazmo88 avatar Aug 28 '18 16:08 lazmo88