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
| Type | Name | Description |
|---|---|---|
string | $search_query | The raw search string. |
int | $weight_title | Title weight used to derive the fuzzy weight. |
array | $args | Query args. |
string | $title_column | Optional column expression. Defaults to wp_posts.post_title. |
string | $content_column | Optional content column expression. When non-empty, its score is added. |
int | $weight_content | Content 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;
} );