Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

Question: How to trigger a re-index programmatically for a single custom type #808

Open
davedbase opened this issue Dec 4, 2018 · 3 comments
Labels

Comments

@davedbase
Copy link

davedbase commented Dec 4, 2018

Hi there,

Sorry if this is not the correct place to post this question, but I'm curious how I can go about forcing a custom type re-index (just one specific record) to Algolia. Our platform has a couple automated procedures that effect the database directly (postmeta specifically) and WP may not directly know about the changes. For this reason we'd like a process to force a trigger.

Thanks,

David

@rayrutjes
Copy link
Member

Hi @ddibiase ,

The easiest way to force a re-index on a post is to update it via the wp_update_post function: https://codex.wordpress.org/Function_Reference/wp_update_post.
This should trigger a re-index in Algolia.

@davedbase
Copy link
Author

Is there an easier way, we perform a lot of batch updates and to trigger the whole post update function is a bit heavy on the platform.

@rayrutjes
Copy link
Member

Another approach would consist of re-indexing everything at a chosen rate leveraging the wp-cli commands shipped with the plugin: https://community.algolia.com/wordpress/wp-cli.html#algolia-search

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants