Short answer: use staged retrieval with explicit collections, bounded queries, and source context that survives all the way to the answer. For a financial research dashboard, I would spend the first week measuring recall and latency before tuning a model. The dashboard is useful only when an analyst can see why a result was selected.
The constraint that changes the design
The expensive failure is not a slow vector search by itself. It is a query that fans out across too many documents, then asks a reranker or language model to clean up the mess. A broad query can look clever in a demo and still miss the filing that contains the one qualifying footnote.
Measure it.
I treat every user request as a small contract: allowed sources, date range, tenant, maximum candidates, and a deadline. Those fields are stored with the request so an answer can be replayed. This also gives a solo SaaS team a revenue-per-hour lens. If a query cannot explain its limit, it will eventually explain a support ticket.
The first implementation is deliberately boring. Ingestion, candidate retrieval, and answer assembly are separate functions. The boundary is the point.
type RetrievalContract = {
query: string;
collection: string;
asOf: string;
maxCandidates: number;
deadlineMs: number;
};
type Candidate = {
id: string;
text: string;
sourceUrl: string;
publishedAt: string;
score?: number;
};
export async function retrieve(contract: RetrievalContract): Promise<Candidate[]> {
const started = Date.now();
const response = await fetch("https://api.example.test/v1/vector/query", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
collection: contract.collection,
query: contract.query,
limit: Math.min(contract.maxCandidates, 40),
filter: { publishedAt: { lte: contract.asOf } }
}),
signal: AbortSignal.timeout(contract.deadlineMs)
});
if (!response.ok) throw new Error(`retrieval status ${response.status}`);
const payload = await response.json() as { items: Candidate[] };
console.info({ stage: "vector-query", elapsedMs: Date.now() - started, count: payload.items.length });
return payload.items;
}
The endpoint is a placeholder for any HTTP vector service. The important behavior is bounded limit, an as-of filter, and a timeout that is visible in logs. In production I keep the raw response identifiers, not just the final snippets.
How should retrieval architecture handle financial research dashboard query limits?
Start with four limits, then adjust them using traces rather than instinct.
| Limit | Starting rule | What it protects |
|---|---|---|
| Candidate count | 40 per collection, 2 collections maximum | Reranker latency and token use |
| Time window | An explicit asOf timestamp |
Accidental use of future information |
| Query fan-out | One lexical and one vector pass | Predictable tail latency |
| Evidence budget | Three cited passages per claim | Reviewability in the dashboard |
These are not universal constants. They are testable defaults. A quarterly revenue question may need a narrow filing collection; a sector comparison may need market commentary as a second collection. The contract decides which one.
For a rerank step, pass only candidates that cleared metadata filters. Reranking ten relevant passages beats reranking one hundred vaguely related chunks. I also keep a lexical fallback for tickers, dates, and exact table labels. Embeddings are good at meaning; they are not a substitute for identifiers.
My first draft had a single topK knob. That was a mistake. During a demo, an analyst searched for an amended filing and the service fanned out over every tenant's commentary collection; the response still arrived, but the reranker spent the deadline budget comparing near-duplicates, and the dashboard showed a plausible older number. Nothing crashed. The result was worse: it looked trustworthy. I traced the request by collection, date filter, and candidate count, then split the limit into fan-out and evidence budgets. It hid whether poor recall came from chunking, filtering, or the ranker. The fix was to log retrieved, reranked, cited, and dropped counts for every request. One line of JSON saved more debugging time than another weekend of prompt edits.
A smallest working ingestion and rerank loop
Documents should be chunked with stable IDs and source metadata before they enter the index. When a filing changes, delete or supersede the old chunk; do not silently append a second copy. Near-duplicates inflate scores and make a dashboard appear more certain than its evidence.
type Chunk = { id: string; collection: string; text: string; metadata: Record<string, string> };
export async function upsertChunks(chunks: Chunk[]): Promise<void> {
const response = await fetch("https://api.example.test/v1/vector/upsert", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ items: chunks })
});
if (!response.ok) throw new Error(`index status ${response.status}`);
}
export function selectEvidence(items: Candidate[], maxPerClaim = 3): Candidate[] {
return items
.filter((item) => item.sourceUrl && item.publishedAt)
.sort((a, b) => (b.score ?? 0) - (a.score ?? 0))
.slice(0, maxPerClaim);
}
The answer builder receives Candidate[], never an untraceable string. It must attach the source URL and publication date to each claim. If no candidate passes the evidence rule, the UI should say that the dashboard has insufficient evidence. That is a useful state, not a failure to hide.
Freshness deserves its own job. A scheduled fetch can use a web search stage to discover changed filings, then scrape the selected page and enqueue only the changed chunks. Keep that discovery path observable; a stale index is a data-quality bug even when the vector service is healthy.
What I would change at scale, and what I would refuse
At higher volume, I would add per-tenant budgets, a queue for ingestion, and sampled human judgments for recall and precision. I would also pin an evaluation set of real questions: ticker aliases, amended filings, empty-result cases, and questions whose answer is “not disclosed.” Measure p50 and p95 latency beside recall@k. A faster wrong answer is still wrong.
There is a real trade-off. More candidates can improve recall, but they increase rerank time and make citations harder to inspect. More aggressive freshness checks improve timeliness, but they add fetch load and operational noise. Your mileage may vary with document length and analyst behavior; I’m not sure a single global limit can survive every asset class.
This design is not suitable when users need unconstrained exploratory search across millions of uncurated pages. In that case, use a dedicated search system and let the dashboard link out to evidence. Stick with a staged, bounded pipeline when each displayed number must be defensible during review.
I ship one measurement change each week. The undifferentiated plumbing belongs behind a generic HTTP interface, while the product work stays in ranking policy and evidence presentation. That keeps the solo team focused on the feature that earns the next subscription.
Top comments (1)
For financial research, query limits should be paired with a visible completeness contract. Users need to know which date range, source set, and result cap shaped the answer before they act on it. I would return that metadata with every result and surface a deliberate escalation path for broader retrieval, rather than silently truncating evidence.