Recent

Fuzzy_Search class Pro only

Class to handle fuzzy search — MySQL stored-function lifecycle and score SQL generation.

Namespace: WebberZone\Better_Search\Pro
Source: includes/class-fuzzy-search.php line 20

Methods

__construct()

Constructor.

Line: 25

public function __construct(  );

activation_hook()

Activation hook.

Since: 4.0.0
Line: 42

public function activation_hook(  );

create_fuzzy_index() static

Recreate the fuzzy helper functions in the database.

Since: 4.0.0
Line: 51

static public function create_fuzzy_index(  );

delete_fuzzy_index() static

Drop all fuzzy stored functions.

Since: 4.3.0
Line: 249

static public function delete_fuzzy_index(  );

is_fuzzy_index_installed() static

Check if the fuzzy index is installed.

Since: 4.0.0
Line: 266

static public function is_fuzzy_index_installed(  ): bool;

Returns: bool — True if both functions are installed, false otherwise.

is_levenshtein_function_installed() static

Check if the Levenshtein function is installed.

Since: 4.0.0
Line: 305

static public function is_levenshtein_function_installed(  ): bool;

Returns: bool — True if the function is installed, false otherwise.

is_phrase_similarity_lev_installed() static

Check if the levenshtein phrase similarity function is installed.

Since: 4.0.0
Line: 316

static public function is_phrase_similarity_lev_installed(  ): bool;

Returns: bool — True if the function is installed, false otherwise.

is_phrase_similarity_soundex_installed() static

Check if the soundex phrase similarity function is installed.

Since: 4.0.0
Line: 327

static public function is_phrase_similarity_soundex_installed(  ): bool;

Returns: bool — True if the function is installed, false otherwise.

get_fuzzy_index_name() static

Get the fuzzy index name.

Since: 4.0.0
Line: 356

static public function get_fuzzy_index_name(  ): string;

Returns: string — The fuzzy index name.

get_fuzzy_index_level() static

Get the fuzzy index level.

Since: 4.0.0
Line: 368

static public function get_fuzzy_index_level( $args = ... ): int;
TypeNameDescription
array$argsArray of arguments.

Returns: int — The fuzzy index level.

is_fuzzy_active()

Check whether fuzzy scoring is active for a given search query.

Since: 4.3.0
Line: 394

public function is_fuzzy_active( string $search_query, array $args = ... ): bool;
TypeNameDescription
string$search_queryThe raw search string.
array$argsQuery args.

Returns: bool

get_fuzzy_score_sql()

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.

Since: 4.3.0
Line: 420

public function get_fuzzy_score_sql( string $search_query, int $weight_title, array $args = ..., string $title_column = ..., string $content_column = ..., int $weight_content = ... ): string;
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.

Returns: string — SQL fragment or empty string.

missing_index_notice()

Display admin notice if the fuzzy index is not created.

Since: 4.0.0
Line: 461

public function missing_index_notice(  );