Question: How to trigger a re-index programmatically for a single custom type
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
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.
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.
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