Table of contents :

Synonyms for Brands, Products and Categories

100-days-of-elasticsearch-woocommerce-037

Table of contents :

WooCommerce search often fails for reasons that have little to do with relevance scoring. Customers may search for a brand’s abbreviated name, an alternative product name, or a category term that differs from the wording stored in the catalogue. Elasticsearch synonyms can bridge those differences, but only when they are designed around the way the catalogue and shoppers actually use language.

Where synonyms fit in a WooCommerce search architecture

A synonym is a relationship between two or more terms that should be treated as equivalent, or as related in a specific direction. For example, a store might want hp to match hewlett packard, or trainers to match sneakers.

Synonyms are applied by an Elasticsearch analyzer. The analyzer may be used when indexing product fields, when parsing a user query, or at both stages. For most WooCommerce implementations, query-time expansion is the safer default because the original indexed terms remain available and synonym rules can be changed without reindexing the entire product catalogue.

Separate brand, product, and category synonym sets

Do not put every catalogue term into one unrestricted synonym list. A term can have different meanings depending on the field in which it appears. Brand synonyms, product-name alternatives, and category vocabulary usually need different ownership, review processes, and matching rules.

Brand synonyms

Brand names commonly have abbreviations, punctuation variations, and legal or regional naming differences. Examples include:

  • hp, hewlett packard
  • p&g, procter and gamble
  • levi's, levis
  • north face, the north face

Use equivalent rules only when the terms are genuinely interchangeable for the business. A brand abbreviation may be ambiguous in a general search index, so it is often safer to apply the rule to a dedicated brand field or to a query branch that targets brand data.

Product synonyms

Product synonyms represent the names customers use for the same product or product family. Examples include:

  • mobile phone, smartphone
  • tv, television
  • ssd, solid state drive
  • running shoes, running trainers

Product terminology requires more caution than simple spelling normalization. A synonym should not erase a meaningful distinction such as model generation, capacity, compatibility, or product type. For example, ipad and tablet may be related for discovery, but they are not necessarily equivalent for filtering or exact product identification.

Category synonyms

Category synonyms are useful when a store’s taxonomy uses internal terminology that differs from customer language:

  • cell phones, mobile phones, smartphones
  • fridge, refrigerator
  • pants, trousers
  • flash drives, usb sticks

Category synonyms should be reviewed with the merchandising team. Expanding a query to a broad category can increase recall but also produce unexpected results if the category hierarchy is not equivalent. In many cases, a category synonym should influence the category filter or category query rather than being applied indiscriminately to every product text field.

Equivalent rules and directional rules

Elasticsearch supports equivalent synonym rules and explicit directional mappings. An equivalent rule such as the following treats each term as interchangeable:

mobile phone, smartphone, cell phone

A directional rule uses => to expand or normalize one expression into another:

cell => mobile phone

Use equivalent rules when customers should receive comparable results for every listed term. Use directional rules when one phrase is an alias, abbreviation, misspelling, or legacy term that should map to a preferred vocabulary. Directional rules are especially useful when a catalogue has an approved brand or category name but customers search with an older name.

Prefer search-time synonyms for frequently changing catalogues

Index-time synonyms are embedded into analyzed field values. They can work well for stable terminology, but changing them generally requires reindexing affected documents. They can also make phrase behavior and token positions more difficult to reason about.

Search-time synonyms are applied while parsing the query. This keeps the index compact and allows a WooCommerce agency to update merchandising vocabulary without rebuilding every product document. A typical search analyzer can use a standard tokenizer, lowercase filter, and a search-only synonym filter:

{
  "settings": {
    "analysis": {
      "filter": {
        "store_synonyms": {
          "type": "synonym_graph",
          "synonyms": [
            "tv, television",
            "ssd, solid state drive",
            "trainers, sneakers"
          ]
        }
      },
      "analyzer": {
        "product_search": {
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "store_synonyms"
          ]
        }
      }
    }
  }
}

The synonym_graph filter is important for multi-word alternatives because it preserves token-graph information used by phrase-aware queries. The exact Elasticsearch configuration depends on the version and on whether synonyms are supplied inline, from a file, or through a managed synonym set.

Use a dedicated search analyzer

A common mapping pattern is to use one analyzer at index time and a synonym-aware analyzer at search time:

{
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "analyzer": "standard",
        "search_analyzer": "product_search"
      },
      "brand": {
        "type": "text",
        "analyzer": "standard",
        "search_analyzer": "brand_search"
      }
    }
  }
}

This design allows the same product document to retain its original terms while the query analyzer expands approved alternatives. In a WooCommerce integration, make sure the analyzer names are present in the index template or index creation request before product data is synchronized.

Do not use synonyms as a replacement for structured fields

Synonyms improve text matching, but they should not replace structured brand IDs, category IDs, attributes, or taxonomies. A WooCommerce product should still expose fields such as:

  • A normalized brand identifier and display name
  • Category IDs and the category path
  • SKU and product IDs
  • Attribute values such as size, color, compatibility, and capacity
  • Searchable product title and description fields

For example, a search for nike can use a synonym or alias to improve text matching, but a brand filter should be generated from the canonical Nike brand identifier. This prevents a text expansion from accidentally selecting products whose descriptions merely mention the brand.

Query-time behavior for multi-word synonyms

Multi-word synonyms need testing with the query types used by the storefront. A match query, a multi_match query, and a phrase query can produce different behavior when an alternative contains several tokens. When phrase relevance matters, use the synonym-aware analyzer with queries that understand token graphs and test both the original phrase and its expansion.

A practical product search request might target the title, brand, and category path with different boosts:

{
  "query": {
    "multi_match": {
      "query": "cell phone",
      "fields": [
        "name^5",
        "brand^3",
        "category_path^2",
        "description"
      ],
      "type": "best_fields"
    }
  }
}

The synonym analyzer is selected by the mapped search_analyzer. If brand and category synonyms have different rules, map those fields to appropriate analyzers rather than applying one global list to all text.

Operational practices for agencies

  1. Version the vocabulary. Store synonym files or managed synonym definitions alongside deployment configuration, with a change log and an approver.
  2. Test before publishing. Maintain representative queries for brand aliases, category terms, product phrases, and terms that must remain distinct.
  3. Measure recall and precision. Review zero-result searches, click-through rates, add-to-cart behavior, and cases where synonym expansion introduces irrelevant products.
  4. Protect exact identifiers. Do not expand SKUs, model numbers, or regulated product codes unless the mapping is explicit and tested.
  5. Plan reload or deployment behavior. Depending on the Elasticsearch version and synonym configuration, changes may require an analyzer reload, index recreation, or a rolling deployment.
  6. Keep WooCommerce and Elasticsearch taxonomy aligned. A synonym that exists only in search configuration cannot correct a missing or incorrectly synchronized product category.

Common mistakes

  • Adding broad relationships such as shoes, footwear when the terms represent different catalogue scopes.
  • Using a brand synonym to drive a brand aggregation or filter instead of filtering on a canonical brand field.
  • Applying synonyms at index time and forgetting that a vocabulary change requires reindexing.
  • Ignoring pluralization, punctuation, stop words, and the order of filters in the analyzer chain.
  • Allowing a synonym rule to expand a high-frequency abbreviation that has several unrelated meanings.
  • Publishing multi-word rules without testing phrase queries and autocomplete behavior.

A controlled synonym strategy gives WooCommerce shoppers the vocabulary flexibility they expect while preserving the precision needed for facets, filters, and merchandising. Treat brand, product, and category alternatives as managed search data, keep canonical catalogue fields authoritative, and validate every rule against real storefront queries before releasing it.

Trending posts
You might also like