Skip to content

Commit

Permalink
Merge pull request #3609 from 10up/feature/issue-3607
Browse files Browse the repository at this point in the history
Add synonyms and weighting settings to the status report
  • Loading branch information
felipeelia authored Aug 29, 2023
2 parents a830747 + b169340 commit 0a7feb5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions includes/classes/StatusReport/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace ElasticPress\StatusReport;

use \ElasticPress\Features as EP_Features;
use \ElasticPress\Feature\Search\Search;

defined( 'ABSPATH' ) || exit;

Expand Down Expand Up @@ -57,6 +58,10 @@ function( $feature ) {
}
ksort( $fields );

if ( method_exists( $this, "get_{$feature->slug}_extra_fields" ) ) {
$fields = call_user_func( [ $this, "get_{$feature->slug}_extra_fields" ], $fields, $feature );
}

$groups[] = [
'title' => $feature->get_short_title(),
'fields' => $fields,
Expand All @@ -65,4 +70,32 @@ function( $feature ) {

return $groups;
}

/**
* Extra fields for the Search feature
*
* @since 4.7.1
* @param array $fields Current fields
* @param Search $feature Feature object
* @return array New fields
*/
protected function get_search_extra_fields( array $fields, Search $feature ) : array {
if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
return $fields;
}

return array_merge(
$fields,
[
'synonyms' => [
'label' => __( 'Synonyms', 'elasticpress' ),
'value' => '<pre>' . $feature->synonyms->get_synonyms_raw() . '</pre>',
],
'weighting' => [
'label' => __( 'Search Fields & Weighting', 'elasticpress' ),
'value' => $feature->weighting->get_weighting_configuration(),
],
]
);
}
}

0 comments on commit 0a7feb5

Please sign in to comment.