Short answer: use freshness windows as a policy layer around retrieval, not as a single global timeout. Keep a short window for prices and availability, a longer one for ingredients and restaurant identity, and refuse an answer when the evidence is outside its window. That choice keeps a menu assistant useful without letting yesterday's page masquerade as today's truth.

In a fintech product that watches merchant menu pages, this is also an indexing decision. Every crawl creates a versioned document and a diff event. The assistant searches only versions that are still admissible for the field being answered. I measure that behavior with replayed page snapshots before tuning a model; a polished answer built on stale text is still a failed transaction.

The failure is usually stale evidence, not bad ranking

A menu page can change in place. A PDF can keep the same URL while its allergen table changes. A delivery widget can render availability after JavaScript runs, so the HTML captured at 09:00 does not prove a dish is available at 19:00. Ranking can select the most relevant chunk and still be wrong because the chunk has expired.

Treat each extracted fact as a record with provenance: source URL, capture time, content hash, parser version, and the span that produced the fact. Store the page snapshot separately from the normalized menu item. The hash lets a watcher emit a diff only when meaningful content changes, while the capture time lets retrieval enforce a window.

A useful rule is to make freshness part of eligibility, then let ranking operate on the survivors:

Fact class Starting window Why it expires this way
Price, tax, promotion 15 minutes Checkout-facing values move often
Availability, opening hours 2 hours Service state changes during a day
Ingredients and allergens 24 hours Changes are less frequent, but safety matters
Address and restaurant identity 7 days Usually stable; verify on a page change

These are operating defaults, not universal truths. A venue with lunch-only stock may need a 30-minute availability window; a regulator may require a shorter allergen window. Your mileage may vary, so log the age distribution of accepted evidence and adjust per field instead of hiding a larger timeout in configuration.

How should retrieval architecture handle menu freshness windows?

Use two clocks. The crawl clock records when a source was fetched. The fact clock records the effective time claimed by the page, when one is present. If a page says “valid through Friday,” that statement can narrow eligibility but cannot make an old capture fresh. When clocks disagree, choose the stricter bound and surface the capture time to the answer composer.

The ingestion path is deliberately boring: fetch under the site's published rules, normalize text, hash the canonical representation, and write an immutable snapshot. A diff worker compares the new hash with the previous one and publishes an event. Re-index changed sections first; keep unchanged vectors and metadata. This avoids paying to re-embed a 20-page menu because one lunch special changed.

At query time, classify the requested field before retrieval. “How much is the ramen?” gets the price window. “Does it contain sesame?” gets the allergen window. “Is the dining room open?” gets the hours window. Classification can be a small deterministic map with a model fallback, but the policy must remain inspectable. Do not ask a similarity score to make a time decision.

Here is a minimal TypeScript shape for the gate. It uses plain data so the same policy can run in a worker, an API, or a test replay:

type FactKind = "price" | "availability" | "allergen" | "identity"; type Evidence = { text: string; capturedAt: number; sourceUrl: string; kind: FactKind; hash: string; }; const windowMs: Record<FactKind, number> = { price: 15 * 60_000, availability: 2 * 60 * 60_000, allergen: 24 * 60 * 60_000, identity: 7 * 24 * 60 * 60_000, }; export function admissible(evidence: Evidence, now = Date.now()): boolean { const age = now - evidence.capturedAt; return age >= 0 && age <= windowMs[evidence.kind]; } 

The answer should cite the surviving source span and say when it was captured. If no evidence survives, return a clarification or a re-crawl request. A confident fallback to an expired price is worse than a short “I need a newer menu snapshot.”

What does this cost at indexing scale?

Index cost is driven by changed text, not by the number of user questions. Keep raw snapshots in cheap object storage, metadata in a transactional store, and vectors only for current or recently useful sections. A content-addressed hash makes identical captures cheap: the same bytes point to one stored blob.

The watcher should debounce noisy pages. Require a stable hash across two fetches for cosmetic changes, or compare a DOM projection that removes timestamps and rotating identifiers. Never debounce fields whose semantics are inherently immediate, such as a sold-out flag, without an explicit business rule.

I benchmark three numbers: bytes fetched per merchant-day, changed chunks embedded per diff, and the percentage of answers blocked by expiry. Those metrics expose the real trade-off. A tiny window may protect freshness while forcing expensive crawls; a huge window lowers index work while increasing stale-answer risk. The right point is the one your error budget accepts, measured by field.

Where this design is a poor fit

Time windows are not a substitute for an authoritative inventory feed. They are unsuitable when a restaurant promises second-level stock accuracy, when prices are personalized per user, or when legal policy requires signed source updates. In those cases, use the authoritative system for the answer and keep page retrieval as explanatory context.

They are also awkward for a tiny static menu that changes once a season. A scheduled daily snapshot and explicit “last checked” label may be simpler than a diff pipeline. Stick with a basic cache when the team cannot operate crawl retries, parser versioning, and provenance storage; a sophisticated freshness policy without observability becomes config bloat.

The practical decision is narrow: define freshness by fact, store evidence as versions, and make expiry a hard retrieval filter. Then test it against captured pages, including JavaScript-rendered states and PDFs, before trusting the assistant in a checkout flow.

Edge cases hurt.

For a production rollout, replay a week of captured merchant pages and annotate every field transition: a price edit, a deleted item, a late JavaScript payload, a PDF replacement, and a temporary outage represented only as a missing capture. Compare the policy decision with the source snapshot at the user request time, then inspect disagreements by class. This long pass matters because freshness bugs hide between components: the crawler may have a current page while the parser still emits an older section, or the vector index may retain a deleted chunk after the metadata row has been replaced. Keep a monotonic source version, reject evidence from a future clock, and attach the exact hash to the citation. Once those invariants hold, you can shorten a window with confidence because the test tells you which answers become clarifications and which remain grounded.

Sources