cd /news/ai-search/e-commerce-product-search-retrieval-… · home › topics › ai-search › article
[ARTICLE · art-175070] src=dev.to ↗ pub= topic=ai-search verified=true sentiment=↑ positive

E-commerce Product Search Retrieval: Go's 5 Freshness Checks for Evaluation Sets

A developer describes building a versioned, time-aware evaluation set for e-commerce product search retrieval, treating each test example as an event tied to a catalog snapshot, tenant, timestamp and graded judgments rather than a static row of text. The approach splits evaluation into four slices — exact identifiers, natural-language needs, policy-sensitive constraints and freshness probes — each with its own recall and ranking thresholds, and pairs a vector index with a lexical index plus a final filter that checks market and availability against the revision recorded in each candidate. The author argues that static evaluation sets can report flattering scores while shoppers see discontinued colors and stale prices, and provides a Go function that hashes product_id, revision, chunk_index and text into an idempotency key for chunk revisions.

recommendation

Version evaluation queries against catalog snapshots and filter candidates by their recorded revision before serving, so stale or retired products are caught and mismatches are explainable.

more in playbook: Retrieval and RAG
by read5 min views6 publishedNov 23, 2026

Catalog changes are the constraint that decides whether an evaluation set is useful. Short answer: build a versioned, time-aware set of product queries and judge retrieval against the catalog state that existed when each query was issued; then use the same set to compare chunking, indexing, and refresh policies. A static set can report a flattering score while shoppers see discontinued colors and yesterday's prices.

In an e-commerce product search system, a result has two obligations: lexical or semantic relevance, and factual validity at serving time. The second obligation is easy to miss in a retrieval-augmented generation (RAG) design because the embedding index often looks like an immutable artifact. Product descriptions, inventory flags, regional eligibility, and delivery promises are mutable records. A document chunk that was relevant on Monday can be actively misleading on Tuesday.

I treat each evaluation example as an event, not a row of text. It needs a query, the catalog snapshot identifier, the tenant or market, a timestamp, and graded judgments. The snapshot makes a failed result explainable: was the retriever weak, or did the test ask it to retrieve a product that no longer existed? That distinction matters for audit trails and for an exactly-once mindset in ingestion. Replaying an event should not silently create a second judgment or move a document into a newer snapshot.

The RAG paper by Lewis and colleagues (2020) describes retrieval as a separate memory component for generation, which is a useful boundary here: measure retrieval before a language model has a chance to hide missing evidence behind fluent prose.

Start with the failure modes that the set must expose. For product search, I use four slices: exact identifiers such as SKU and model number; natural-language needs such as “quiet red kettle”; policy-sensitive constraints such as “available in Germany”; and freshness probes for newly added, changed, and retired products. Each slice gets its own recall and ranking thresholds. One aggregate number is not a decision rule.

The architecture follows from those slices. Keep a canonical product record in a transactional store, emit an outbox event for every meaningful change, and materialize searchable chunks with a deterministic (product_id, revision, chunk_index) key. A vector index can serve semantic candidates, while a lexical index catches identifiers and rare attributes. A final filter checks market and availability against the revision recorded in the candidate. This costs an extra read, but it prevents stale metadata from becoming a customer-facing promise. In practice, that filter also gives reconciliation a clear ledger: the candidate says which revision it saw, the catalog says which revision is currently sellable, and the evaluator can classify the mismatch instead of counting it as an unexplained ranking miss. If an event is delivered twice, the revision key and a uniqueness constraint let the indexer acknowledge the second delivery without creating a duplicate chunk; if events arrive out of order, the consumer compares revisions before replacing the searchable document. Those details are mundane until a sale depends on them.

Freshness wins or the score is noise.

Here is the small part I make deterministic in Go. The hash is an idempotency key for a chunk revision, not a substitute for a database constraint.

package eval

import (
    "crypto/sha256"
    "encoding/hex"
    "fmt"
)

type ProductChunk struct {
    ProductID string
    Revision  int64
    Index     int
    Text      string
}

func ChunkKey(c ProductChunk) string {
    material := fmt.Sprintf("%s:%d:%d:%s", c.ProductID, c.Revision, c.Index, c.Text)
    sum := sha256.Sum256([]byte(material))
    return hex.EncodeToString(sum[:])
}

The test data should resemble the catalog's clock. I keep a small, hand-reviewed set for every change class, then add sampled production queries with personally identifying data removed. For each query, the expected set records acceptable product IDs and an expiry policy; judgments are graded, because “same product family” is not equivalent to “exact variant.”

Slice Mutation What it catches Useful metric
New item Published after the previous index build Refresh lag Recall@10 by age bucket
Edited attribute Size, color, or compliance text changed Mixed revisions Revision-consistency rate
Retirement Item removed or blocked in a market Ghost results Invalid-result rate
Identifier SKU or model query Tokenization loss MRR for exact match
Ambiguous need Short natural-language query Chunk boundaries nDCG@10

The important number is not only recall. Track the age of the newest indexed revision returned for a query, and alert when the p95 exceeds the product promise. I also record the index build ID and retriever configuration with every run. When a score moves, that metadata lets an engineer reproduce the result instead of arguing from screenshots.

Run the matrix in CI for chunking changes, in staging against a frozen snapshot, and continuously against a rolling window of recent events. A canary should compare both relevance and freshness violations; promoting a model because nDCG rose while retired products increased is a correctness regression. For payment-adjacent catalogs or regulated claims, retain the judgment and revision trail according to the applicable retention policy, and have compliance approve what may be logged.

The catch is operational cost. Maintaining snapshots, graded labels, and dual lexical/vector retrieval takes more storage and review time than a single static benchmark. It is not suitable when the catalog is tiny, changes rarely, and a human reviews every result; a simpler lexical index and a weekly smoke set may be the better engineering choice. Stick with a static benchmark when you are measuring a one-off prototype, but do not use that score to promise production freshness.

I am not sure one universal freshness threshold exists: delivery promises differ by market and category. Your mileage may vary. The threshold should come from the user-visible policy, then be encoded in the evaluation set so it cannot drift unnoticed.

── more in #ai-search 4 stories · sorted by recency
── more on @go 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/e-commerce-product-s…] indexed:0 read:5min 2026-11-23 · —