Synonyms

Synonyms are words or phrases that mean exactly or nearly the same as another word or phrase. If a number of terms are defined as synonyms, then searching for one of those terms returns the results for all of the terms. You can also exclude specific synonyms using negative synonyms. Brand synonyms are automatically generated.

However, if both terms have overlapping search results, the search results for synonyms might be less than the total number of each term if they are not synonyms.

Synonyms are stemmed when added to the product and content index. For example, if you configure synonyms in that include lock, when a customer searches for lock, results are returned for locks, locker, and locked and their synonyms, which are also stemmed. In the following example, you can see that the same result set is returned for the synonym group, including all words containing the same word stems, such as plurals.

Configured Synonyms Customer Searches For Salesforce B2C Commerce Query Results Returned For
bag, purse, pocketbook bag bag OR purse OR pocketbook bag, bags, purse, purses, pocketbook, pocketbooks
  purse bag OR purse OR pocketbook bag, bags, purse, purses, pocketbook, pocketbooks
  pocketbook bag OR purse OR pocketbook bag, bags, purse, purses, pocketbook, pocketbooks



Terms might have overlapping results if both terms appear in the searchable fields for the product. For example, if a product has as a searchable long description, "The Ice Cap is the perfect hat for...", then it would be found by a search for hat or a search for cap. Many people, when creating synonyms, expect that the search results for the synonyms should be equal to the search results for all of the individual terms. However, synonym searches don't return duplicate results, so overlapping results are only returned once.

B2C Commerce searches for synonyms for a maximum of four words in an entered search phrase. If the user searches for big nice back packs, the query encoder tries to find a synonym for:
  • big nice back packs (4 words max)
  • big nice back or nice back packs (combination of three words)
  • big nice or nice back or back packs (combination of two words)
  • big or nice or back or packs (single keyword).
For this reason, if you configure a synonym with more than four terms, it's never searched. For example, don't configure a synonym phrase such as the following that has more than four terms; it's never found:
backpacks, backpack, back pack back packs rucksack ruck sack
Instead configure:
backpacks, backpack, back pack, back packs, rucksack, ruck sack

Negative Synonyms

If you enter synonyms (single or multi-word) with the '-' negative synonym operator in front of it, products containing the negative synonym are not returned in the search results.

Example 1

You can set up a synonym group that looks like jeans, -skirts, so that a customer who is looking for a pair of jeans doesn't see skirts returned because they are jean skirts.

Synonym Group Customer Searches For... Actual Salesforce B2C Commerce Query
jeans, -skirts jeans jeans AND NOT skirts

Example 2

You can set up a synonym group that looks like car accessories, -household, -technology, so if a customer searched for car accessories, the negative terms, -household and -technology would be added to the query. The search result would include floor mats but not air fresheners or cell phone cables.

However, if the customer searched for household (or -household), the term car accessories would not be searched because household was not configured as synonym but as a negative term to a synonym car accessories.

Synonym Group Customer Searches For... Actual Commerce Cloud B2C Commerce Query
car accessories, -household, -technology car accessories car accessories NOT household AND NOT technology
  household household

Example 3

Regular synonyms are applied to negative queries as well. If "chukkas" and "boots" are synonyms, a customer search that must not include "chukkas" also must not include "boots".

Synonym Group Customer Searches For... Actual Commerce Cloud B2C Commerce Query
chukkas, boots -chukkas NOT chukkas AND NOT boots
  -boots NOT chukkas AND NOT boots