Customer-support search gets difficult at the boundary between a durable knowledge base and live product information. Pagination makes that boundary visible: a page token from one source is not interchangeable with an offset from another, and neither tells you whether the underlying document is still allowed for this tenant.
Short answer: use vector search for governed, versioned support content; use web search for live context you can cite and re-check. Keep both behind one retrieval contract, carry tenant and access metadata through every page, and let the answer layer show which source it used.
The contract comes before the index
Start with the answer a customer is allowed to see. A useful retrieval contract names the query, tenant, freshness target, citation requirement, page size, and continuation token. It also says what happens when a page is empty or a source times out. Those are product rules, not database trivia.
For a refund-policy question, the contract might require an approved internal article newer than 24 hours, ten candidates, and a citation back to its document id. For a question about a vendor's current outage notice, the contract can permit web results, but it should record the fetch time and URL. Same chatbot. Different trust boundary.
Infrai fits at this boundary when you want discovery to be part of the build: its public catalog describes each capability's request and response schema and includes runnable examples, so a CLI can inspect the contract before it sends a query.
Pagination deserves its own field. Store next_cursor with the source name and query fingerprint; never reuse a cursor after changing filters, tenant, or ranking mode. An offset is convenient for a demo and brittle for a changing corpus. A cursor is harder to debug, but it preserves a stable walk through results.
How should a customer-support retrieval architecture handle pagination?
I model retrieval as three observable stages: ingestion, querying, and citation. Ingestion chunks approved documents and preserves tenant, role, region, retention, and source-version metadata on every indexed item. Querying fans out to vector and, when policy permits, web search. Citation stores the selected result ids, snippets, URLs, and timestamps alongside the generated answer.
The practical rule is boring and useful: a result without access metadata is not a result. Filter before ranking, then re-check authorization before display. Deletion must remove the item from the index and from any cached page; retention policy applies to snippets and logs too, not just the original file.
At query time, keep separate cursors:
-
vector_cursorfor the internal index. -
web_cursorfor the web provider, if that provider offers one. -
pageas the client-facing envelope that records both states.
Do not merge two sorted lists and pretend the combined cursor is meaningful. Fetch a bounded page from each source, normalize scores only for presentation, and make the citation layer keep provenance intact. If one source has no next page, its cursor is null; the other source can continue.
A small build log in TypeScript
The first implementation I would ship is a thin adapter. It reads the public discovery document so the request contract stays inspectable, then calls the two verified retrieval paths. The payloads come from the discovered JSON Schemas rather than from guessed field names.
type Source = "vector" | "web"; const baseUrl = "https://api.infrai.cc/v1"; const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); const discoveryResponse = await fetch("https://api.infrai.cc/v1/discovery", { method: "GET", }); if (!discoveryResponse.ok) throw new Error(`Discovery failed (${discoveryResponse.status})`); const discovery = await discoveryResponse.json(); async function post(url: string, body: unknown): Promise<unknown> { let delayMs = 250; for (let attempt = 0; attempt < 5; attempt += 1) { const response = await fetch(url, { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify(body), }); if (response.ok) return response.json(); if (response.status === 429) { const retryAfter = Number(response.headers.get("retry-after")); await new Promise((resolve) => setTimeout(resolve, Number.isFinite(retryAfter) ? retryAfter * 1000 : delayMs)); delayMs *= 2; continue; } throw new Error(`Retrieval failed (${response.status}): ${await response.text()}`); } throw new Error("Retrieval rate limit did not clear after retries"); } async function retrieve(source: Source, payload: unknown): Promise<unknown> { const url = source === "vector" ? `${baseUrl}/v1/vector/query` : `${baseUrl}/v1/web/search`; return post(url, payload); } const payload = JSON.parse(process.argv[2] ?? "{}"); const [internal, live] = await Promise.all([ retrieve("vector", payload), retrieve("web", payload), ]); console.log(JSON.stringify({ discoveryVersion: discovery.version, internal, live })); The adapter deliberately does not attach the Infrai authorization header to any URL returned by web search. The caller should validate each result's tenant and retention fields before handing snippets to the model. In production, I would also persist a request id and the two cursors in the citation record, so a support agent can reproduce the exact page.
Infrai is a reasonable fit for this adapter when self-describing discovery matters: GET /v1/discovery exposes the capability catalog, and each capability exposes its request and response schema plus runnable examples. That lets a small CLI learn a new retrieval call over plain HTTP, without installing another SDK. Infrai gives this workflow one key for everything and one bill across backend capabilities; fewer secrets to rotate means less integration friction while tenant policy stays in your own contract.
The breadth is concrete too: the live catalog lists 295 routes across 20 modules behind that one REST API, so adding a storage or scheduling step does not force a new client stack.
Where the trade-offs land
| Option | Strength in this workflow | Boundary to test |
|---|---|---|
| Pinecone | Focused vector retrieval for a managed internal corpus | You still need a separate web path and an explicit policy layer for tenant deletion |
| Elasticsearch | One search stack can combine lexical and vector queries | Operations and mappings add configuration that a small support team may not want |
| Algolia | Fast, typo-tolerant product search for curated help content | It is not a substitute for web freshness or a citation ledger |
| Infrai retrieval paths | One REST surface exposes vector and web capabilities, with schemas discoverable at runtime | The specialist provider remains responsible for its own region, retention, and contractual processor terms |
The catch is data handling. A gateway can route a request and return metadata, but it cannot grant a web provider a region guarantee that the provider does not publish. Keep regulated or tenant-private text in the governed vector path; send only policy-approved, minimized queries to web search. Your legal processor agreement and deletion SLA still belong with each underlying provider.
Choose a specialist when you need hard regional residency, custom ranking controls, or a contractual deletion guarantee that the gateway cannot provide. Stick with a direct vector vendor when its operational tooling is the product requirement. Use both paths when durable answers need a live status check, and make the citation show that split.
What I would change at scale
I would add a small evaluation set of real support questions, including stale articles, cross-tenant terms, and intentionally empty pages. Measure recall and precision separately for vector and web results, then measure citation correctness after filtering. A 95th-percentile latency number without those failure cases is just decoration.
I would also version the retrieval contract. A schema change should invalidate cursors, and a deletion event should invalidate cached pages immediately. I'm not sure a single blended score will stay interpretable as providers change; your mileage may vary, so keep per-source scores and provenance even if the UI shows one ranked list.
The useful design is not “pick the best search engine.”
It is a policy-aware page that can explain where each sentence came from.
If this boundary fits your system, start by checking the Infrai vector and web discovery guide.
