Did_You_Mean
Handles “Did you mean” spelling suggestions and autocorrect.
Namespace: WebberZone\Better_Search\Pro
Since: 4.4.0
Source: includes/pro/class-did-you-mean.php line 22
Methods
__construct()
Constructor.
Line: 44
public function __construct( Fuzzy_Search $fuzzy_search, Spell_Dictionary $spell_dictionary );
| Type | Name | Description |
|---|---|---|
Fuzzy_Search |
$fuzzy_search |
Fuzzy search instance. |
Spell_Dictionary |
$spell_dictionary |
Spell dictionary instance. |
suggest_did_you_mean()
Suggest a “Did you mean” correction when a search still returns zero results.
Registered at priority 20 on better_search_query_the_posts (after like_fallback_search)
so it still fires when LIKE fallback is disabled or custom tables are in use.
Since: 4.4.0
Line: 64
public function suggest_did_you_mean( $posts, $query, $instance ): \WP_Post[];
| Type | Name | Description |
|---|---|---|
\WP_Post[] |
$posts |
Array of post objects. |
\WP_Query |
$query |
The WP_Query instance. |
\Better_Search_Core_Query |
$instance |
The Better_Search_Core_Query instance. |
Returns: \WP_Post[] — Array of post objects, potentially auto-corrected.