Add --post-ids parameter to wp algolia reindex WP-CLI command
Is your feature request related to a problem? Please describe. I'm trying to reindex a specific post, or group of posts.
Describe the solution you'd like
I would love to be able to trigger a reindex based on a given post id, preferably multiple IDs
wp algolia reindex --ids=1,2,3,4,5
Which would also allow something like:
wp algolia reindex --ids=$(wp post list --post_type=event --format=ids)
Describe alternatives you've considered
wp algolia reindex --all but I've got a lot of content, so it's a very slow workaround.
Additional context It would also be helpful if I could specify a post type and have say, all "events" reindexed.
Definitely some valid ideas here, especially if you're very intentionally wanting to use the WP-CLI integration we have. For example based on your example, perhaps re-indexing just events on a cron schedule, but not worrying about other content types.
That said, manually updating the posts should be triggering a reindex individually for the item being edited, in case you just have a small handful that you want to get re-indexed.
Leaving this issue open for consideration of WP-CLI enhancements.
Yeah it’s just an annoying amount of posts sadly. E.g. 50, with WPML with each in 4 different languages. 200 posts right away!
Something needing considered here is that we allow for more than just indexing posts, we also allow for taxonomy/terms, and users. So any new flag to specify IDs will also need to have the content type for the IDs.
Related: https://github.com/WebDevStudios/wp-search-with-algolia/issues/458
Also we'll want to evaluate which flags can't be used together, for example from what already exists: specifying a specific index + --all
Mm fair point. I'm wondering what the "usual" approach is for this scenario with other plugins?
Relevanssi has --post for a single post ID. Struggling to think of any other plugins right now that might cover posts and taxonomies in the same command.
Maybe --posts or --post-ids would be clear? (and --terms?)
Will most likely do --{$type}-ids=... but want to make sure all is good overall. I know for some "WP All Import" support, we added the ability with posts to specify IDs, which is part of what birthed the #458 ticket, getting things more in sync.
Branch: feature/454-post-ids-cli-param