Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #442: Running WP_CLI command wp algolia reindex --all would clear index even if --clear flag is not specified #443

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
dont clear index if not specified
  • Loading branch information
menno-ll authored Dec 11, 2024
commit 1d65db526d779e472059373277afb0531cc67b8e
2 changes: 2 additions & 0 deletions includes/class-algolia-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ private function do_reindex( Algolia_Index $index, $clear, $from_batch ) {
$index->clear();
// translators: the placeholder will contain the name of the index.
WP_CLI::success( sprintf( __( 'Correctly cleared index "%s".', 'wp-search-with-algolia' ), $index->get_name() ) );
} else {
add_filter( 'algolia_clear_index_if_existing', '__return_false' );
}

$total_pages = $index->get_re_index_max_num_pages() - ( $from_batch - 1 );
Expand Down