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

Terms: Adjust fuzziness for admin term search queries #2417

Merged
merged 4 commits into from
Oct 20, 2021
Merged
Changes from all commits
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
15 changes: 15 additions & 0 deletions includes/classes/Feature/Terms/Terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function setup() {
*/
public function search_setup() {
add_filter( 'ep_elasticpress_enabled', [ $this, 'integrate_search_queries' ], 10, 2 );
add_filter( 'ep_term_fuzziness_arg', [ $this, 'set_admin_terms_search_fuzziness' ] );
}

/**
Expand Down Expand Up @@ -107,4 +108,18 @@ public function requirements_status() {
return $status;
}

/**
* Change fuzziness level for terms search in admin
*
* @param {int} $fuzziness Amount of fuzziness to factor into search
* @since 3.6.4
* @return int
*/
public function set_admin_terms_search_fuzziness( $fuzziness ) {
if ( is_admin() ) {
$fuzziness = 0;
}
return $fuzziness;
}

}