Recent

bsearch_fuzzy_similarity_function filter Pro only

bsearch_fuzzy_similarity_function

Build the fuzzy score SQL fragment for a given search query.

When a content column and weight are supplied, the score is the sum of the title fuzzy score and the content fuzzy score, ensuring that a typo present only in post_content still produces a positive score.

Type: filter
Since: 4.3.0
Source: includes/class-fuzzy-search.php line 435

Parameters

TypeNameDescription
string$search_queryThe raw search string.
int$weight_titleTitle weight used to derive the fuzzy weight.
array$argsQuery args.
string$title_columnOptional column expression. Defaults to wp_posts.post_title.
string$content_columnOptional content column expression. When non-empty, its score is added.
int$weight_contentContent weight used to derive the content fuzzy weight.

Usage

add_filter( 'bsearch_fuzzy_similarity_function', function($search_query, $weight_title, $args, $title_column, $content_column, $weight_content) {
    // ...
    return $search_query;
} );