Short answer: use one versioned, paragraph-sized evidence record with explicit issuer, filing date, effective date, and access-scope fields; apply hard filters before vector similarity, then rerank only the small candidate set. That schema keeps a financial research dashboard explainable while leaving enough latency budget for an e-commerce relevance reranker.
A semantic index is not a bag of embeddings. It is a set of claims with identity and time attached. Lose that metadata and a dashboard can return a beautifully similar sentence from the wrong quarter, an amended filing, or a document the analyst is not allowed to see. I learned to treat the vector as a recall hint, never as the source of truth.
What should a semantic retrieval schema preserve for a financial research dashboard?
Start with the unit that a person can verify. For a filing, that is usually a paragraph or a small group of sentences, not a whole PDF page and not an arbitrary 1,536-token slice. Store the original text, a stable document identifier, and offsets back to the source. Store both published_at and effective_from; those dates answer different questions. A restatement may be published today but describe an earlier reporting period.
The minimum record I use looks like this:
type EvidenceRecord = { id: string; text: string; embedding: number[]; issuerId: string; instrumentIds: string[]; documentType: "10-K" | "10-Q" | "transcript" | "news"; fiscalPeriod: string; publishedAt: string; effectiveFrom: string; effectiveTo?: string; sourceUri: string; charStart: number; charEnd: number; aclGroupIds: string[]; contentHash: string; schemaVersion: 1; }; contentHash makes re-indexing idempotent. schemaVersion lets a backfill coexist with live traffic. The offsets matter during review: an analyst should be able to jump from an answer to the exact paragraph rather than trust a generated citation. For an e-commerce catalog, the same shape can carry product category, locale, and inventory visibility, which is useful when the final job is reranking results for relevance.
Do not put mutable prices, permissions, or current inventory only inside the embedding text. Those values belong in filterable columns or a side store. Embeddings age; filters should not.
How do semantic retrieval, schema design, and latency interact?
The request path is a funnel. Normalize the query, resolve entities and dates, apply authorization and hard constraints, retrieve a broad candidate set, then rerank perhaps 20 to 100 records. Returning 1,000 vectors to an expensive reranker is an architecture decision, not a free tuning knob.
type SearchRequest = { query: string; issuerId?: string; asOf: string; limit: number; aclGroupIds: string[]; }; type Candidate = EvidenceRecord & { vectorScore: number }; async function retrieveEvidence(req: SearchRequest): Promise<Candidate[]> { const parsed = await parseResearchQuery(req.query); const filtered = await vectorStore.search({ vector: await embed(parsed.semanticText), topK: 80, filter: { issuerId: req.issuerId, effectiveFrom: { lte: req.asOf }, effectiveTo: { gt: req.asOf, missing: true }, aclGroupIds: { intersects: req.aclGroupIds }, documentType: { in: parsed.allowedDocumentTypes } } }); return rerank(parsed.semanticText, filtered.slice(0, 40)); } The exact storage engine can change. The contract cannot: a candidate must carry its dates, source location, and permission context all the way to answer generation. I keep a 40-item rerank cap as a configurable policy, not a universal truth; your mileage may vary because model speed, hardware, and text length differ. Measure p50 and p95 latency separately from recall. A fast result that omits the one relevant amendment is a failed search.
One small but expensive mistake is filtering after similarity search. Suppose an analyst is restricted to two issuers. If the nearest 20 chunks belong to ten other issuers, post-filtering can leave an empty or biased set. Pre-filtering also makes permission behavior auditable.
Failure modes that make a plausible result wrong
Chunk boundaries are the first trap. Splitting a table row from its header turns “3.2%” into an orphaned number. Preserve table captions and section paths in the text sent for embedding, while keeping the raw representation for display. Deduplicate near-identical earnings releases, or the index will reward repetition rather than evidence. I once traced a relevance complaint to two chunks that differed only by a footnote marker: both landed in the top ten, consumed reranker budget, and pushed out a genuinely different disclosure. The fix was to hash normalized text plus the source section, then retain the newest copy only when the issuer and reporting period matched. That is a data policy, not a model setting, and it belongs in the ingestion test suite.
Time is the second trap. A query such as “margin outlook as of March” needs an as-of clock, not just a publication filter. Keep a small temporal test set with questions whose answer changes after a restatement. Run it whenever an ingestion job changes; otherwise a schema migration can silently rewrite history. The test should include a pre-amendment filing, its amended successor, and a transcript that quotes the older number. Assert both the selected citation and the rejected candidates, because a result can look correct while still leaking a later fact into an earlier point-in-time view. Log the effective interval used by the filter so an analyst can explain why a document disappeared.
Keep it boring.
The third trap is access control. A vector database may return a semantically perfect private note unless ACL predicates are part of retrieval. Redacting it later is too late: the candidate already influenced the prompt.
For e-commerce reranking, the analogous failures are stale availability, locale mixing, and variant duplication. A product description can be semantically close while the SKU is out of stock. Filter those facts before the reranker, then let lexical signals such as exact model numbers rescue precision.
A practical decision rule for shipping
Choose paragraph-level records when analysts need citations and the corpus has clear document structure. Choose smaller sentence windows when latency is tight and documents are repetitive. Keep a parent-document pointer in either case so a reviewer can expand context.
The catch is that this design is not suitable when you need arbitrary joins, millisecond-wide fan-out across billions of changing rows, or strict numeric aggregation. Stick with a relational or columnar query for balances, ratios, and point-in-time calculations, then use semantic retrieval to locate the explanatory evidence. A vector index is a poor calculator.
Before launch, I check four things in one staging query: every hit passes the ACL predicate; every citation resolves to stored offsets; every as-of test returns the expected version; and p95 stays inside the dashboard budget with reranking enabled. I also log query text, filter decisions, candidate counts, and model versions without logging restricted document bodies. That gives a useful trail when relevance drops after a new embedding model.
There is no magic schema. The winning one is the smallest record that preserves provenance, time, permissions, and enough context to judge relevance. Build that contract first, then tune chunk size and reranking against real queries from both the research dashboard and the e-commerce search path.
References
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks: https://arxiv.org/abs/2005.11401
- NIST AI Risk Management Framework: https://www.nist.gov/itl/ai-risk-management-framework
- RFC 3339 Date and Time on the Internet: https://www.rfc-editor.org/rfc/rfc3339
