SearchWP

This Documentation is for SearchWP Version 3

Taking time to customize the synonyms used on your website can go a long way in helping visitors find what they’re looking for. Sometimes your content may be full of industry jargon that’s sometimes referenced using other words. Other times your content may always refer to one term while your visitors are searching for another. Using synonyms you can customize the search experience for your visitors to ensure that your content is found.

Screenshot of synonym handling in SearchWP

When managing synonyms on your site, enter the source search term (e.g. the term that your visitors will enter in your search form) in the Search Term field. Next, enter the applicable synonym(s) for that search term in the Synonym(s) field.

The Replace checkbox controls whether the source Search Term is retained when the search takes place. When the Replace checkbox is ticked, the Search Term will be removed for the search. When left unticked, the Synonym(s) will be appended to the Search Term.

Synonyms can be sorted using the handles next to the Replace checkbox. New synonyms can be added using the Add New button.

How Synonyms are processed

Note: this applies to SearchWP version 3.1+

Synonym processing has been implemented in such a way that its goal is to generate the best search results. Given that, the default processing works as follows:

  1. Determine which synonyms to add to the search query
  2. Remove applicable removals
  3. Rebuild the search query

This implementation is the most generalized and least aggressive way to process synonyms, generating the most comprehensive resulting search string.

There is another synonym processing method built in however, which can be enabled with the searchwp_synonyms_aggressive hook. In contrast to the default processing implementation, this aggressive method will apply synonym replacements as each synonym is processed. This mostly comes into effect when synonyms are directly related to one another in that some synonyms include search terms from other synonyms or vice versa.

The default processing method is recommended, but this more aggressive processing routine is also available if you’d like to use that instead.