EnterpriseNot open source: This functionality is only available commercially.
Using Features Together
The e-commerce features are designed as standalone components that can be composed together.
This page covers the configuration needed
when features interact at feed time or query time.
Read the individual feature pages before this one:
The schemas, services configuration, and other examples on this page are illustrative.
Adapt field names, document types, and configuration values to match your application.
Saved Search with Multi-Currency
When saved search notifications and
multi-currency pricing are used together,
the saved search document processor generates per-currency price features at feed time.
This enables saved searches with price filters to match products
regardless of the seller's currency.
How It Works
Without multi-currency, a saved search like price in [100..200] matches against the product's
single price field. With multi-currency enabled, the document processor:
Reads the product's per_market_price entries and seller_currency
Converts each price to every known currency using the forex rates
Scales the converted prices to integers by multiplying with priceScaleFactor
(e.g., a factor of 100 preserves two decimal places).
Predicate ranges require integer values, so this step is needed to retain precision.
Generates predicate range features named {featurePrefix}_{currency}_{market}
(e.g., price_NOK_DEFAULT, price_EUR_NO)
Feeds these features alongside the regular attributes into the predicate query
A saved search filtering on NOK prices can then use price_NOK_DEFAULT in [1000..1500]
as its predicate expression, and it will match products originally priced in any currency.
Predicate Upper Bound
The predicate field's upper-bound in the saved search schema must be large enough
to cover the highest possible scaled converted price.
Because prices are both currency-converted and scaled by priceScaleFactor,
the resulting values can be significantly larger than the original prices.
Warning:
If any single range feature in a predicate query exceeds the
upper-bound, Vespa rejects the entire predicate query for that document,
not just the out-of-range feature. This means the product will not match any saved searches at all.
For example, with a scale factor of 100 and a EUR-to-SEK rate of ~11.76:
a product priced at 200 EUR produces price_SEK_DEFAULT = 200 × 11.76 × 100 = 235,294.
The upper-bound must be at least 235,294 for this to work.
Choose an upper bound that covers your highest-priced products converted to
the weakest target currency, multiplied by the scale factor.
A generous margin is recommended to accommodate price and exchange rate fluctuations.
Schema Setup
The following are minimal examples showing the fields required from each feature.
Your schemas will likely have additional fields and configuration.
Product Schema
The product schema must include fields from both features:
the saved search attributes (price, category, etc.)
and the multi-currency fields (seller_currency, per_market_price).
schema product {
document product {
# Saved search attributes
field price type int {
indexing: attribute
}
field category type string {
indexing: attribute
}
# Multi-currency fields
field seller_currency type string {
indexing: summary | attribute
}
struct market_price {
field market type string {}
field price type double {}
}
field per_market_price type array<market_price> {
indexing: summary
summary: matched-elements-only
struct-field market {
indexing: attribute
}
struct-field price {
indexing: attribute
}
}
}
}
Saved Search Schema
Set the upper-bound high enough to cover scaled converted prices.
See Predicate Upper Bound above.
schema saved_search {
document saved_search {
field filters type predicate {
indexing: attribute
index {
arity: 2
lower-bound: 3
upper-bound: 250000
dense-posting-list-threshold: 0.25
}
}
}
}
Services Configuration
Both features are configured in the same container cluster.
The example below shows a combined setup — the key addition is the multicurrency block inside the
ecommerce-schema-wiring config of the document processor:
These parameters are part of the ecommerce-schema-wiring config
and only apply when the saved search document processor is used together with multi-currency:
Parameter
Description
Type
Default
multicurrency.enabled
Enable generation of per-currency price features at feed time.
bool
false
multicurrency.featurePrefix
Prefix for the generated predicate range features. A feature is named {prefix}_{currency}_{market}.
string
price
multicurrency.priceScaleFactor
Integer multiplier applied to converted prices before feeding as predicate range features. Predicate ranges require integer values, so this preserves decimal precision. A factor of 100 preserves two decimal places.
int
100
Note:
The productFields config block is shared between both features. When combining, use the same field names in the searcher and document processor configurations.
Feeding Workflow
When both features are active, the feeding workflow is:
Feed the forex document (id:forex:forex::forex) and wait for the CachedForexRateService to reach READY state
Feed saved search documents to the content cluster
Feed products to the notification-route — the document processor will generate multi-currency predicate features and match against saved searches
Warning:
The forex rates must be loaded before feeding products to the notification route.
If the ForexRateService is not ready, the document processor cannot generate currency-converted price features.