SearchWP & WP-CLI
SearchWP has built-in support for a number of WP-CLI commands.
Commands
wp searchwp index [--site=<all|ids>] [--rebuild]
- Build (or rebuild) the SearchWP index
wp searchwp reindex <id>... [--source=<source>]
- Reindex entries
wp searchwp diagnostics <tokens|status> [--source=<source>]
- Diagnose information about SearchWP’s index
Examples
- Trigger the indexer
wp searchwp index
- Rebuild the index
wp searchwp index --rebuild
- Reindex
WP_Post
114 wp searchwp reindex 114
- Reindex
WP_Post
s 88 and 314 wp searchwp reindex 88 314
- Reindex all
WP_Post
s of Page post type wp searchwp reindex $(wp post list --post_type=page --format=ids)
- Reindex
WP_User
2 wp searchwp reindex 2 --source=User
- Retrieve tokens for
WP_Post
19 wp searchwp diagnostics tokens 19
- Retrieve index status for
WP_User
7 wp searchwp diagnostics status 7 --source=User