Table of contents :

Why Some WooCommerce Products Rank Higher

100-days-of-elasticsearch-woocommerce-022

Table of contents :

When shoppers search a WooCommerce store, products are not returned in a random order. Elasticsearch evaluates several signals, including how closely a product matches the query, which fields contain the match, how often terms occur, and any business rules added by the store. This is why two products that appear equally relevant in the catalog can receive very different positions.

For agencies, improving product ranking starts with identifying which signals the search integration actually sends to Elasticsearch. A well-designed index and query can make product discovery more predictable without relying on manual ordering for every category or keyword.

Text relevance is usually the first ranking signal

Elasticsearch commonly uses the BM25 similarity algorithm for full-text queries. BM25 considers term frequency, the rarity of a term across the index, and field length. A product containing the exact searched terms in a short, focused title can therefore outrank a product where the same terms appear only once in a long description.

For example, a query for blue running shoes is likely to favor a product whose title is Blue Running Shoes over a product titled Performance Footwear with those words mentioned several times in its description. The result depends on the mapping and query, but the general principle is consistent: matching important terms in important fields increases relevance.

Field boosts make some matches more valuable

Most product searches should not treat the title, SKU, category, attributes, and description as equivalent. A title or exact SKU match usually deserves more weight than a match in long-form product content.

A multi-match query can express this prioritization:

{
  "multi_match": {
    "query": "blue running shoes",
    "fields": [
      "name^5",
      "sku^8",
      "categories.name^3",
      "attributes.value^2",
      "description"
    ],
    "type": "best_fields"
  }
}

In this example, a match in sku receives the strongest boost, followed by the product name and category names. The exact values should be tested against real searches. Excessive boosts can produce undesirable results, such as a weak title match beating a highly relevant product whose category or attributes match the query more completely.

Exact matches and analyzed matches behave differently

WooCommerce product fields are often indexed in both analyzed and keyword forms. An analyzed field is split into searchable terms, while a keyword field is treated as one complete value. A search for an exact SKU, brand, or product code should generally use the keyword representation when one is available.

For example, the following query can give an exact SKU match a separate scoring advantage:

{
  "bool": {
    "should": [
      {
        "term": {
          "sku.keyword": {
            "value": "ABC-123",
            "boost": 10
          }
        }
      },
      {
        "match": {
          "name": {
            "query": "ABC-123",
            "boost": 3
          }
        }
      }
    ],
    "minimum_should_match": 1
  }
}

The field name depends on the mapping generated by the WooCommerce search solution. Agencies should inspect the index mapping before adding queries that assume a particular .keyword subfield.

Product data quality directly affects ranking

Elasticsearch can only rank the information that has been indexed. Missing or inconsistent WooCommerce data weakens relevance even when the search configuration is correct.

  • Use descriptive, customer-facing product titles rather than internal naming conventions.
  • Store important properties such as size, color, material, and compatibility in structured attributes.
  • Keep brand names and category labels consistent across products.
  • Index useful SKU and variation identifiers when customers search for them.
  • Remove boilerplate content that causes unrelated products to match the same terms.
  • Reindex products after changing titles, attributes, taxonomies, or searchable custom fields.

Variation-heavy catalogs need special care. If each variation is indexed as a separate document, variation-level attributes can improve precision but may create duplicate-looking results. If only the parent product is indexed, the index must still receive the searchable variation values that customers use, such as size or color.

Analyzers determine what counts as a match

Analyzers process text during indexing and searching. Lowercasing allows Boots and boots to match, while stemming may allow related word forms to match. Stop-word handling, tokenization, accents, and language-specific analyzers can all change the score.

Search-time analysis should normally be compatible with the analyzer used at index time. A common pattern is to use a standard analyzer for ordinary searches and a search_as_you_type or edge-ngram field for autocomplete. Autocomplete fields should not automatically replace the main relevance field, because prefix-oriented tokenization can produce unexpected scores for full product searches.

Synonyms can improve recall for terms such as sneakers and trainers, but they must be managed carefully. Expanding every query with a large synonym set can make unrelated products appear competitive. Test synonyms against customer language and business terminology, and reindex when the synonym configuration requires index-time expansion.

Filters usually narrow results; scoring orders them

A filter for stock status, product visibility, catalog permissions, price range, or category should normally be placed in the filter portion of a Boolean query. Filters restrict the result set without contributing to relevance scoring.

{
  "bool": {
    "must": [
      {
        "multi_match": {
          "query": "waterproof jacket",
          "fields": ["name^5", "categories.name^3", "description"]
        }
      }
    ],
    "filter": [
      { "term": { "status": "publish" } },
      { "term": { "catalog_visibility": "visible" } },
      { "term": { "stock_status": "instock" } }
    ]
  }
}

Putting operational constraints into scoring clauses can make the query harder to reason about and may allow an unavailable or hidden product to compete with valid results. Use scoring logic for ranking preferences and filters for eligibility rules.

Business signals can change the order

Text relevance is not always the complete business definition of a good result. A store may want in-stock products, popular products, high-margin products, or products with strong conversion rates to receive additional consideration. These signals should supplement text relevance rather than replace it.

A function_score query can combine the text score with a numeric field such as sales volume:

{
  "function_score": {
    "query": {
      "match": {
        "name": "running shoes"
      }
    },
    "field_value_factor": {
      "field": "sales_30d",
      "modifier": "log1p",
      "factor": 0.2,
      "missing": 0
    },
    "boost_mode": "multiply",
    "max_boost": 3
  }
}

The logarithmic modifier prevents a product with ten times more sales from automatically receiving ten times the boost. A maximum boost limits the business signal so that a popular but barely matching product does not outrank a product that directly satisfies the query.

Freshness, margin, click-through rate, and conversion rate can be used in a similar way, provided the values are normalized and updated reliably. Do not use order volume without considering catalog age, because older products naturally accumulate more sales.

Sorting can override relevance entirely

One of the most common reasons a product appears to rank unexpectedly is an explicit sort order. Sorting by price, date, popularity, or a WooCommerce menu position can replace score-based ordering. If the integration sends a sort clause, Elasticsearch may no longer use relevance as the primary order.

For a relevance-driven search, confirm that the request uses _score as the primary sort. If a secondary sort is needed for stable pagination, use it only after the score:

"sort": [
  { "_score": "desc" },
  { "product_id": "asc" }
]

Category archives and search results do not necessarily need the same ordering. A category page may intentionally use merchandising order, while a keyword search should usually prioritize textual relevance and exact product identifiers.

Why a product can rank lower than expected

  • The searched phrase appears only in a low-boost field such as the description.
  • The product title uses a synonym that is not configured in the analyzer.
  • The product is missing structured attributes that competing products contain.
  • A filter excludes the product because it is out of stock, hidden, or assigned to an inaccessible catalog state.
  • An explicit price, date, or menu-order sort overrides the relevance score.
  • A popularity function gives established products too much influence.
  • Variations or custom fields were changed in WooCommerce but not reindexed.
  • Pagination uses an unstable sort, causing products to appear to move between requests.

A practical relevance testing process

Agencies should create a search-quality test set before changing boosts or analyzers. Include exact product names, partial names, SKUs, brands, attributes, misspellings, synonyms, broad category terms, and searches with no valid match.

  1. Record the expected products and acceptable ordering for each query.
  2. Run the queries against a staging index using the same mappings and analyzers as production.
  3. Inspect _score and use Elasticsearch’s _explain API for individual documents when a result is surprising.
  4. Change one relevance factor at a time, such as a title boost or popularity weight.
  5. Measure whether the change improves important queries without damaging exact SKU and attribute searches.
  6. Repeat the test after every mapping, analyzer, query, or WooCommerce indexing change.

The goal is not to make every product rank highly. The goal is to make the highest-ranked products the best answers to the shopper’s specific query, while keeping stock, visibility, catalog rules, and merchandising requirements enforceable.

Trending posts
You might also like