Using Synonyms with ElasticPress

ElasticPress allows you to make your site’s search even more intelligent with the Synonyms advanced feature. Synonyms come in three different flavors: Synonyms, Hyponyms, and Replacements.

Synonyms

Synonyms are terms with similar meanings. For example, sneaker, tennis shoe, trainer, and running shoe could all refer to a particular type of shoe.

Use synonyms when you want queries for a specific term to also return results relevant to any of its synonyms. This can be useful for supporting products and services whose names have changed over time or regional variations in terminology. For example, when a search for “sneaker” should return sneakers, tennis shoes, trainers, and running shoes.

Hyponyms

Hyponyms are terms with a more specific meaning than another more generic terms, called a hypernym. For example, aqua, azure, and cerulean are all hyponyms of blue, their hypernym.

Use hyponyms when you want search queries for a parent term to return results relevant to itself or any of its child terms, but search queries for a child term to only return results that are relevant to that term. For example, when a search for “blue” should return anything blue, whether it be aqua, azure, or cerulean, but a search for “cerulean” should return only items that are specifically cerulean blue.

Replacements

Replacements are terms that replace other incorrect or obsolete terms.

Use replacements when you want search queries for certain terms to return results that are only relevant to another term, or set of terms. This can be useful for supporting specific typos or incorrect phrasing. For example, when a search for the phrase “intensive purposes” should only return results including the phrase “intents and purposes”.

You may need to disable fuzziness to have it working properly.

Adding Synonyms

To add Synonyms to your site:

  1. From your site’s WordPress Admin menu click the ElasticPress option from the sidebar, then click Synonyms.
    mceclip1.png
  2. In the Synonyms Screen, select the type of synonym you want to manage and use the controls available to add, edit, or remove your synonyms.
  3. When you’ve finished entering your synonyms, hyponyms, and replacements, click the Save changes button at the bottom of the screen.

Adding Synonyms with the Advanced Text Editor

If you need to add a large number of Synonyms, especially if you’re importing large lists from another program, it may make sense to use the Advanced Text Editor rather than the Visual Editor described above. To add Synonyms using the Advanced Text Editor

  1. From your site’s WordPress Admin menu click the ElasticPress option from the sidebar, then click Synonyms.
    mceclip1.png
  2. At the top of the page, click the Switch to Advanced Text Editor button.
  3. Using the field that becomes available, type or paste your synonyms. Regular synonyms are a simple comma separated list. For Hyponyms, you need to add a list that starts with your parent term, followed by an arrow (=>), and a list with children terms, like blue => blue, aqua, azure, cerulean. Replacements are very similar, but the list after the arrow does not contain the parent term.
  4. When you’ve finished entering your synonyms, click the Save changes button at the bottom of the screen.