Automatic “Did you mean” (search query corrections)
Note: This documentation is for SearchWP 4
SearchWP 3.x: Automatic “Did you mean” (search query corrections)
A popular feature of some search engines is their ability to automatically apply corrections to search queries when no results are found for the original query.
To enable this functionality in SearchWP, tick the checkbox to do so on the Advanced tab of the SearchWP settings screen:
Alternatively this can be enabled with the
When this feature is enabled, SearchWP will automatically attempt to correct any searches that provide zero results in addition to outputting a notice above The Loop of your search results:
⚠️ Style (CSS) customization is likely required ⚠️
The above screenshot outlines the automatic output in Twenty Nineteen, a default WordPress theme. The following CSS can be added to improve its appearance:
Note: (You can add Custom CSS to your site by navigating to Appearance > Customize > Additional CSS in your WordPress Dashboard)
|margin: 0 calc(10% + 60px) 1em;|
|border: 1px solid #e7e7e7;|
Which results in a notification that better matches the site design:
Interoperability with partial matches
When “Did you mean?” functionality is enabled and partial matching is enabled, SearchWP will first attempt to find exact partial matches and utilize partial match functionality.
If no partial matches are found, SearchWP will then utilize its “Did you mean?” functionality, determining the best search correction it can. If no search correction can be determined, SearchWP will show zero results.