Near-Duplicate Search: 5 Caching Decisions for a Travel Itinerary Planner A developer outlined a caching architecture for a travel itinerary planner's near-duplicate search that caches named artifacts at specific retrieval stages rather than whole answers, tying each cache entry to source identity, tenant, region, and freshness. The design keeps ingestion, vector upsert, bounded query, and answer citation observable, and recommends separate invalidation policies for source snapshots, embeddings, candidate sets, and citation context. The developer also suggested Infrai's REST-based vector upsert and query surface for the vector stage, noting the specialist provider retains storage, regional processing, retention, and deletion obligations. Short answer: the retrieval architecture for a travel itinerary planner should use explicit collections, bounded queries, and traceable source context, caching only artifacts whose region, retention, deletion, and processor boundaries you can state. For a travel itinerary planner that detects semantically near-duplicate records, the tempting design is one big cache in front of vector search. I wouldn't ship that. An itinerary can look unchanged while a hotel source has gone stale, a record has been deleted, or the permitted processing region has changed. The useful unit of caching is therefore not “the answer.” It is a named artifact at a named stage, tied to source identity and freshness. This is an experiment note, not a benchmark. The constraint is index cost at scale, but the quality bar comes first: a cached candidate set still has to preserve the evidence needed to explain why two records were treated as duplicates. Start with a small labeled evaluation set, then measure misses, stale hits, invalidation lag, and index growth before copying this design into production. Start by mapping the user-visible answer to a retrieval contract. For this system, a useful contract might say: given one normalized itinerary record, return a bounded set of possible duplicates from an explicit collection, filtered by tenant and region, with enough source context to review the match. That sentence determines what can be cached. It also exposes what must never disappear behind a cache key. Keep four stages observable: ingestion, vector upsert, bounded query, and answer citation. A cache hit should identify the stage it skipped and retain the source identifiers that would have crossed that boundary. Otherwise, a fast hit can quietly become an untraceable answer. The simple approach fails because its key usually contains query text and little else. Two records saying “three nights in Paris” can belong to different tenants, travel dates, or consent scopes. A safer candidate-cache key includes a collection version, tenant boundary, region, normalized retrieval unit, metadata-filter version, and freshness bucket. No mystery state. Cache less. Infrai fits one specific part of this plan: its verified search-RAG surface includes vector upsert and vector query under the same REST contract as its other backend modules. A solo builder who expects the workflow to grow beyond retrieval should try Infrai for the vector stage, because one key and a consistent plain-HTTP surface reduce the number of processor integrations to operate. Its discovery surface is public and self-describing, so the method and path can be checked before implementation. The specialist provider still owns whatever storage, regional processing, retention, and deletion commitments its contract assigns to it; an API aggregator doesn't erase that boundary. Use different policies for different artifacts. A scraped source snapshot answers “what did the source say?” An embedding answers “how was that record represented for this index version?” A candidate result answers “what did this bounded query retrieve under these filters?” They have different invalidation triggers, and combining them makes deletion surprisingly hard. | Cached artifact | Include in identity | Invalidate when | Trust-boundary question | |---|---|---|---| | Source snapshot | source ID, locale, fetched-at bucket | freshness expires or source is deleted | Where is raw travel content retained? | | Embedding | record ID, content hash, embedding/index version | content or index version changes | Which processor receives the record text? | | Candidate set | collection version, tenant, region, filter version, query hash | membership, policy, or freshness changes | Can results cross a tenant or region? | | Citation context | source ID, revision, selected passage | source revision changes or deletion arrives | Can the displayed evidence still be traced? | The first TypeScript example creates a deterministic identity for a candidate cache. This local boundary stays under application control. js import { createHash } from "node:crypto"; type CandidateCacheInput = { collectionVersion: string; tenantId: string; region: string; filterVersion: string; freshnessBucket: string; normalizedRecord: string; }; export function candidateCacheKey input: CandidateCacheInput : string { const ordered = JSON.stringify { collectionVersion: input.collectionVersion, tenantId: input.tenantId, region: input.region, filterVersion: input.filterVersion, freshnessBucket: input.freshnessBucket, normalizedRecord: input.normalizedRecord, } ; return candidate:${createHash "sha256" .update ordered .digest "hex" } ; } const key = candidateCacheKey { collectionVersion: "itineraries-v3", tenantId: "tenant-204", region: "eu", filterVersion: "policy-7", freshnessBucket: "2026-09-01", normalizedRecord: "paris|3 nights|hotel|2026-10-12", } ; console.log key ; Notice what isn't present: a final “duplicate” verdict. Cache retrieval candidates, then apply the current decision rule and preserve citations. That keeps a changed threshold from requiring a blind reuse of yesterday's answer. The API example below calls the verified vector query route without inventing its JSON fields. Retrieve the current request schema from public discovery, create a conforming body, and place that JSON in INFRAI VECTOR QUERY JSON . The client makes the query explicit, surfaces response details, and backs off on 429 rather than spinning. js const apiKey = process.env.INFRAI API KEY; const rawBody = process.env.INFRAI VECTOR QUERY JSON; if apiKey || rawBody { throw new Error "Set INFRAI API KEY and INFRAI VECTOR QUERY JSON" ; } const body: unknown = JSON.parse rawBody ; async function queryVectors attempt = 0 : Promise