Table of contents :

Boosting Product Titles Over Descriptions

100-days-of-elasticsearch-woocommerce-020

Table of contents :

In a WooCommerce catalog, the product name usually carries more commercial intent than the long description. A shopper searching for waterproof hiking boots is generally looking for products whose names identify that item, not products that merely mention waterproof materials somewhere in their description.

Elasticsearch can express this priority directly by assigning a higher boost to the product title field than to the description field. This improves relevance without removing useful descriptive matches.

Why field weighting matters

A basic multi-field search treats every matching field according to the query configuration. Without deliberate weighting, a long description can produce a higher score simply because it contains more matching terms than a concise product name.

For WooCommerce stores, this can create problems such as:

  • Products with a passing mention in the description ranking above products with the search phrase in the name.
  • Long marketing copy overpowering concise, highly relevant product names.
  • Category-specific terminology in descriptions influencing results more than the actual product identity.
  • Shoppers seeing products that discuss an item instead of products that are that item.

Field boosting gives the product name a stronger contribution to the relevance score while preserving the description as a secondary source of matches.

Use a boosted multi-match query

Assume the indexed WooCommerce document contains a name field for the product title and a description field for the full product description. A practical starting query is:

{
  "query": {
    "multi_match": {
      "query": "waterproof hiking boots",
      "fields": [
        "name^4",
        "description"
      ],
      "type": "best_fields",
      "operator": "and"
    }
  }
}

The ^4 suffix gives the name field a boost of four relative to the unboosted description field. It is not a percentage and it does not guarantee that a title match will always rank first. Elasticsearch still combines term frequency, field length, analysis, and other scoring factors.

The best_fields type is suitable when the best-matching field should dominate the score. The operator value of and requires all analyzed query terms to match within the queried fields. If that is too restrictive for your catalog, use or and add a suitable minimum_should_match value.

Add a phrase boost for natural product names

Individual term matching is useful, but an exact phrase in the product name is often a stronger relevance signal. A bool query can combine a general multi-match query with a phrase-specific clause:

{
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "waterproof hiking boots",
            "fields": ["name^4", "description"],
            "type": "best_fields",
            "minimum_should_match": "75%"
          }
        }
      ],
      "should": [
        {
          "match_phrase": {
            "name": {
              "query": "waterproof hiking boots",
              "boost": 6
            }
          }
        }
      ]
    }
  }
}

The first clause provides broad recall. The optional phrase clause adds extra score when the words occur together in the product name. This helps a product named Waterproof Hiking Boots outrank a product whose description contains the same words in unrelated sentences.

Choose sensible boost values

There is no universal boost value. The correct value depends on catalog quality, title length, synonym configuration, and the importance of descriptions for the store.

Common starting points include:

  • name^2 or name^3 for a moderate preference.
  • name^4 or name^5 when product identity should strongly dominate.
  • A separate phrase boost between 3 and 8 for an exact sequence in the name.
  • Lower boosts when product names are incomplete, generic, or heavily templated.

Do not assume that a very large boost automatically produces better search. A value such as name^20 can hide useful matches from specifications and descriptions, particularly when customers search for compatibility details, materials, or technical attributes.

Map title and description fields correctly

Boosting only works as expected when the fields are mapped and populated consistently. A typical text mapping might look like this:

{
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "description": {
        "type": "text"
      }
    }
  }
}

Use the analyzed name field for full-text relevance. The name.keyword subfield is useful for sorting, aggregations, or exact filters, but it is not normally the field to use for a standard analyzed search query.

WooCommerce data sources differ. Some integrations call the field title, others use name, and some store content under a nested product object. Confirm the actual document structure with a representative search or mapping request before changing the query.

Handle short and long descriptions separately

Many WooCommerce catalogs have a short description and a long description. These fields can be weighted independently:

{
  "query": {
    "multi_match": {
      "query": "stainless steel bottle",
      "fields": [
        "name^5",
        "short_description^2",
        "description"
      ],
      "type": "best_fields"
    }
  }
}

A short description often contains curated selling points and can deserve a higher boost than a long description. The long description remains searchable for detailed queries, but it is less likely to dominate results because of its length.

Combine title boosting with WooCommerce filters

Relevance scoring should not replace deterministic catalog rules. Apply stock, visibility, catalog status, language, and taxonomy constraints with filters so they do not affect the text relevance score.

{
  "query": {
    "bool": {
      "filter": [
        { "term": { "status": "publish" } },
        { "term": { "catalog_visibility": "visible" } },
        { "term": { "stock_status": "instock" } }
      ],
      "must": [
        {
          "multi_match": {
            "query": "running jacket",
            "fields": ["name^4", "short_description^2", "description"]
          }
        }
      ]
    }
  }
}

Using filter for non-scoring conditions is generally more efficient and makes the intent of the query clear. If out-of-stock products should remain searchable, remove that filter and use a controlled ranking adjustment instead.

Implement the query in a WooCommerce search service

Keep the field weights in one search-service configuration rather than scattering them across templates or controllers. For example, a PHP integration can construct the query body as an array and send it through the Elasticsearch client:

$body = [
    'query' => [
        'bool' => [
            'filter' => [
                ['term' => ['status' => 'publish']],
            ],
            'must' => [
                [
                    'multi_match' => [
                        'query' => $searchTerm,
                        'fields' => ['name^4', 'short_description^2', 'description'],
                        'type' => 'best_fields',
                        'minimum_should_match' => '75%',
                    ],
                ],
            ],
        ],
    ],
];

$response = $client->search([
    'index' => $productIndex,
    'body'  => $body,
]);

The exact client syntax depends on the Elasticsearch PHP client version and the WooCommerce integration. The important design choice is to keep the title boost explicit and easy to adjust during relevance testing.

Test with real WooCommerce searches

Evaluate title weighting against a query set that represents actual shopper behavior. Include product names, SKU searches, brand searches, attribute searches, partial phrases, misspellings, and queries that should match only descriptive content.

For each query, inspect:

  • Whether the most relevant product appears in the first position.
  • Whether exact or near-exact product names receive a meaningful advantage.
  • Whether attribute queries still find products where the attribute appears only in the description.
  • Whether broad terms produce excessive dominance by popular or long-titled products.
  • Whether filters and merchandising rules remain correct.

Use Elasticsearch’s _explain API or the Profile API when a result behaves unexpectedly. These tools can show whether the title clause, phrase clause, field length, or another query component is responsible for the score.

Watch for title-quality problems

A stronger title boost exposes poor product data more clearly. Duplicate titles, missing brand names, excessive punctuation, variant details stored only in descriptions, and keyword-stuffed names can all reduce the value of title-first ranking.

Before increasing the boost, establish title conventions for the catalog. A useful structure may include brand, product type, defining attribute, and variant identifier, for example Acme Waterproof Hiking Boots – Black, Size 10. Consistent titles improve both search relevance and the shopper’s understanding of the result.

Recommended rollout process

  1. Inspect the indexed field names and mappings used by the WooCommerce search integration.
  2. Record a baseline using the current query and a representative search set.
  3. Introduce a moderate title boost, such as name^3 or name^4.
  4. Add a phrase boost only after confirming that analyzed title matches are working correctly.
  5. Compare ranking changes for exact product searches and attribute-oriented searches.
  6. Monitor zero-result rates, click-through behavior, add-to-cart events, and search refinements.
  7. Adjust field weights and title data together rather than relying on increasingly large boost values.
Trending posts
You might also like