Faceting and filtering on price

Build price-list-style B2B catalog views using stats facets, distinct facets, and price filters on search results.

Ask about this Page
Copy for LLM
View as Markdown

After completing this page, you should be able to:

  • Use stats and distinct facets to summarize price data across a buyer's catalog.

  • Filter results on raw and discount-aware price amounts.

  • Build a per-division price-band catalog view with facets.

Pacific Property Group's two divisions browse the same Zen Electron Trade catalog, but each negotiated different rates through its own distribution Channel. A division buyer wants to see products grouped by price band, such as "show me everything under AUD 500," without a round trip per product. Because Product Search already carries price data in the index, you can answer this with facets and price filters in the search request itself, building a price-list-style view with no extra calls. For a deeper treatment of facet calculations and postFilter, see the Implement product discovery and presentation path.

Facets summarize; filters narrow

Two tools work together on a price-aware catalog page:

  • Facets: aggregate across the result set to describe it, such as the minimum and maximum price or the distinct currencies present. They power the navigation controls (price sliders, currency pickers).
  • Filters (exact and range expressions in the query) narrow the results to what the buyer selected.

Product Search offers several facet types; two matter most for price:

  • Stats facets: compute count, min, max, mean, and sum over a numeric field, which is useful for deriving a price range to seed a slider.
  • Distinct facets: return each distinct value of a field with a count, which is useful for listing the currencies or price points present.

Price fields you facet and filter on

Use the Product Search searchable price fields when you facet or filter on Price data. The main design choice is whether the buyer's price band should use the raw Price amount or the discount-aware amount.
Use variants.prices.centAmount when the band should reflect the raw Price. Use variants.prices.currentCentAmount when the band should reflect the effective Price after discounts. Use the other variants.prices.* fields, such as currency, country, Channel, Customer Group, and discounted status, to keep the result set aligned with the buyer's commercial context.
Product Search has no scopedPrice field. If you have used Product Projection Search before, the paths there (variants.price.centAmount, variants.scopedPrice.value.centAmount) do not exist in Product Search. Always use the variants.prices.* paths. Choosing centAmount versus currentCentAmount decides whether a buyer's price band reflects list or discounted prices, so pick deliberately.

Worked example: a price-band view per division

Pacific Property Group's Residential division trades through Channel chan-ppg-res in AUD. To build its catalog page, request a stats facet that summarizes the division's price range, scoped to its Channel and currency. Use the same buyer context for the facet, the result filters, and the displayed price(...) field so the price band and the rendered Price describe the same commercial view.
{
  productsSearch(
    query: {
      and: [
        { exact: { field: "variants.prices.channel", value: "chan-ppg-res" } }
        { exact: { field: "variants.prices.currencyCode", value: "AUD" } }
      ]
    }
    facets: [
      {
        stats: {
          name: "residentialPriceRange"
          field: "variants.prices.centAmount"
        }
      }
    ]
    limit: 20
  ) {
    total
    facets {
      ... on ProductSearchFacetResultStats {
        name
        count
        min
        max
        mean
      }
    }
    results {
      product { masterData { current { masterVariant {
        sku
        price(currency: "AUD", channelId: "chan-ppg-res") { value { centAmount } }
      } } } }
    }
  }
}
The residentialPriceRange stats facet returns the min and max cent amounts across the division's Channel-scoped catalog, which seeds the price slider. Running the same query with the Commercial division's Channel (chan-ppg-com) returns that division's range. The two divisions see different bands from one query shape because their Channels carry different negotiated prices.

To list which currencies appear (useful for Atlas Corporate's multi-currency divisions), add a distinct facet on the currency field instead:

facets: [
  {
    distinct: {
      name: "currencies"
      field: "variants.prices.currencyCode"
    }
  }
]

Narrowing to a band and to discounted lines

Once the buyer picks a band, narrow the results with a range expression on the price amount. To honor any promotional price, filter on the discount-aware amount.
query: {
  and: [
    { exact: { field: "variants.prices.channel", value: "chan-ppg-res" } }
    { range: { long: { field: "variants.prices.currentCentAmount", lt: 50000 } } }
  ]
}
This returns the Residential division's products whose effective price is under AUD 500. Switching the field to variants.prices.centAmount would band by list price instead, ignoring discounts. To show only discounted lines, add { exact: { field: "variants.prices.discounted", value: true } }.
For faceted navigation, selecting one facet value should narrow results while the facet counts still reflect the broader set. Use the postFilter field rather than folding the selection into query. postFilter applies after facets are calculated, so the facet controls do not collapse to a single value as the buyer drills in.

Key takeaways

  • Stats facets give min/max/mean/sum/count over a numeric price field; distinct facets list each value with a count.
  • Facet and filter on variants.prices.centAmount for raw amounts and variants.prices.currentCentAmount for discount-aware amounts; choose deliberately.
  • Product Search has no scopedPrice field; always use the variants.prices.* paths, unlike Product Projection Search.
  • Scope a stats facet to a buyer's Channel and currency to derive that buyer's price band; the same query shape yields different bands per Channel.
  • Use postFilter for faceted navigation so facet counts reflect the broader result set as the buyer drills in.

Test your knowledge