Skip to content

Commit

Permalink
Make sure the mapping exists before trying to change it
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Feb 27, 2024
1 parent e789e14 commit fc26aa4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/classes/Feature/Search/Synonyms.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ public function update_synonyms() {
function( $success, $index ) {
$filter = $this->get_synonym_filter();
$mapping = Elasticsearch::factory()->get_mapping( $index );
$filters = $mapping[ $index ]['settings']['index']['analysis']['analyzer']['default_search']['filter'];

if ( empty( $mapping ) || empty( $mapping[ $index ] ) ) {
return false;
}

$filters = (array) $mapping[ $index ]['settings']['index']['analysis']['analyzer']['default_search']['filter'];

/*
* Due to limitations in Elasticsearch, we can't remove the filter and analyzer
Expand Down

0 comments on commit fc26aa4

Please sign in to comment.