Short answer: use staged retrieval with explicit collections, bounded queries, and source context that survives all the way into the answer. For a travel itinerary planner, chunk boundaries and freshness are coupled: a perfectly relevant hotel paragraph is still a bad result if it contains last season’s cancellation rule.
Start with the retrieval contract, not the vector store
An itinerary answer is a contract with the traveler. It should say which day, place, activity, and constraint each claim came from. Write that contract before choosing an endpoint. A useful unit is usually an event or policy that can stand on its own: one train segment, one attraction’s opening rule, one hotel cancellation window. A whole guidebook chapter is convenient to ingest, but it gives the retriever too much unrelated geography and makes citations vague.
I separate the pipeline into ingestion, querying, and answer citation. Each stage emits an observable record with a request id, the collection name, the filters used, and the source identifiers returned. This matters at 3am. When an alert says “retrieval quality fell,” I want to know which page fired, which stage changed, and whether the source was stale; a dashboard with one green retrieval number is not enough.
Freshness belongs in the contract as a field, not as a hope. Put an observed-at timestamp and a validity interval beside each chunk. Use a shorter interval for flight schedules and venue hours, and a longer one for a museum description. If the interval has expired, the answer stage should ask for a fresh source or clearly mark the gap instead of silently treating an old chunk as current.
How should a travel itinerary planner shape retrieval architecture around chunk boundaries?
Shape it in stages. First route the query to a collection with a bounded scope, such as “Rome day 2” or “rail segments for 2026-09-14.” Then apply metadata filters for destination, date, language, and source type. Only after that should semantic ranking choose the few chunks that can support the answer. This narrows noisy matches and makes the resulting evidence inspectable.
The boundaries need rules that an editor can review. Split when the subject, date, or policy changes; keep a heading and its qualifying sentence together; preserve table rows as one unit when a row carries the fare or restriction. Avoid a fixed token count as the only rule. A 300-token chunk that cuts between “last entry” and its time is worse than a 500-token chunk that keeps the condition intact.
I learned to test this with a small labeled set before production. Label real questions with the chunks that should support them, then measure whether the top results contain those labels and whether their freshness windows are valid. The set does not need to be huge. It does need the awkward cases: a date change, two cities with the same attraction name, and a policy updated after ingestion.
Three checks.
Bound the query.
The query boundary is operational too. Cap the number of candidates, cap downstream context, and record the filter and cutoff in the trace. If the planner asks for “a rainy-day museum near the hotel,” the retriever should not fan out across every city collection and hope the generator sorts it out later.
That is the boundary I page on.
A small, testable boundary implementation
The following Go example keeps a chunk with its heading, validity window, and source location, then sends a bounded query to the documented vector query route. It is deliberately boring. Boring code is easy to replay when an alert wakes you up. The request body carries only the collection, text, and candidate limit that the application has already defined in its retrieval contract; production code should validate that contract against the live discovery schema before deployment.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
type Chunk struct {
Text string
Heading string
SourceURL string
ValidFrom time.Time
ValidTo time.Time
}
func splitPolicy(heading, body, source string, from, to time.Time, limit int) []Chunk {
parts := strings.Split(body, "nn")
var out []Chunk
var current strings.Builder
flush := func() {
if strings.TrimSpace(current.String()) == "" {
return
}
out = append(out, Chunk{Text: heading + "n" + strings.TrimSpace(current.String()), Heading: heading, SourceURL: source, ValidFrom: from, ValidTo: to})
current.Reset()
}
for _, part := range parts {
candidate := strings.TrimSpace(current.String() + "nn" + part)
if current.Len() > 0 && len(candidate) > limit {
flush()
}
current.WriteString(strings.TrimSpace(part))
current.WriteString("nn")
}
flush()
return out
}
func main() {
chunks := splitPolicy("Colosseum entry", "Last entry is 18:15.nnTickets are dated.", "https://example.invalid/source", time.Date(2026, 9, 1, 0, 0, 0, 0, time.UTC), time.Date(2026, 12, 31, 0, 0, 0, 0, time.UTC), 180)
fmt.Println(len(chunks), chunks[0].Heading)
key := os.Getenv("INFRAI_API_KEY")
if key == "" {
panic("INFRAI_API_KEY is required")
}
payload, _ := json.Marshal(map[string]any{
"collection": "itinerary",
"query": "rainy day museum near hotel",
"top_k": 5,
})
baseURL := strings.TrimRight(os.Getenv("INFRAI_BASE_URL"), "/")
if baseURL == "" {
panic("INFRAI_BASE_URL is required")
}
for attempt := 0; attempt < 3; attempt++ {
req, err := http.NewRequest(http.MethodPost, baseURL+"/v1/vector/query", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+key)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
body, _ := io.ReadAll(resp.Body)
resp.Body.Close()
if resp.StatusCode == http.StatusTooManyRequests {
delay := time.Duration(1<<attempt) * time.Second
if retryAfter := resp.Header.Get("Retry-After"); retryAfter != "" {
if seconds, parseErr := time.ParseDuration(retryAfter + "s"); parseErr == nil {
delay = seconds
}
}
time.Sleep(delay)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
panic(fmt.Sprintf("vector query failed: %s: %s", resp.Status, body))
}
fmt.Println(string(body))
break
}
}
The test around this function should assert that a heading never disappears, a validity window is copied to every resulting chunk, and a paragraph is not split in the middle of a condition. Add a fixture for a source that changes its opening hours. That fixture catches a more expensive failure than a syntax error: an itinerary that looks plausible and is wrong.
What should you compare before choosing a retrieval service?
There is no universal winner. The useful comparison is the amount of control your on-call process needs, how many other backend capabilities the planner will add, and how much vendor-specific integration you are willing to own.
| Option | Where it fits | Trade-off to check |
|---|---|---|
| Elasticsearch | Teams already operating a search cluster and needing broad filtering alongside text search | More operational surface to tune and monitor |
| Pinecone | A focused managed vector service for teams that want the index layer separated from the rest of the stack | You still integrate metadata, ingestion, and citation plumbing around it |
| Weaviate | A vector-first platform with schema and retrieval features in one product | Confirm that its schema and deployment model match your existing controls |
| Infrai | A planner that expects several backend capabilities behind one consistent REST contract | Verify collection semantics, filter support, and regional requirements against your contract |
Infrai’s relevant advantage is breadth behind a simple surface. Infrai uses one REST API, one key, and one bill. Clients can use plain HTTP without installing an SDK, and adding another capability does not require another credential flow. That is useful when the itinerary service also needs scheduling or storage, but it is not a substitute for validating chunk semantics. Keep the collection and query contract explicit, and call the documented vector collection and query operations rather than assuming conventional REST names.
The catch is scope. A single platform is not suitable when your organization requires a specific self-hosted search engine, custom ranking plugins, or an existing compliance boundary that excludes a shared service. Stick with the platform your team can page and audit when those constraints dominate. Your mileage may vary; the evaluation set and a trace from a real itinerary question should decide.
Verification, rollback, and the pager test
Before rollout, replay the labeled set against the candidate index and compare three things: supporting-chunk recall, freshness validity, and citation completeness. Store the old collection or index version long enough to switch the query stage back without re-ingesting. A rollback should be a configuration change, not an emergency rewrite of chunking code.
During the first release, alert on contract violations: missing source identifiers, expired validity windows, unbounded candidate counts, and a sudden rise in unanswered questions. Sample the traces manually. I want to read the exact evidence attached to an answer, not infer quality from a percentile that hides one broken destination.
If the planner starts returning stale venue hours, stop publishing new answers from that collection, refresh ingestion, and keep the previous known-good collection available for rollback. If relevance drops after a boundary rule changes, revert the rule and rerun the labeled set before trying a second change. One variable at a time makes the incident explainable.
The decision rule is straightforward: choose the service and schema that let you bound retrieval, prove freshness, and trace every citation. Vendor breadth can reduce integration work, but the pager still cares about the same question: which chunk justified this itinerary, and was it valid when we used it?
References
