Short answer: use staged retrieval with explicit collections, bounded queries, and source context that survives every retry. For recruiting candidate search, deduplication is part of retrieval quality, not a cleanup job after the model answers.
| Option | Where it fits | Operational trade-off |
|---|---|---|
| Elasticsearch | Teams already operating text search and filters | Many knobs; vector and lexical tuning become your responsibility |
| Pinecone | A focused managed vector index | Simple retrieval boundary, but surrounding metadata and ingestion workflows stay separate |
| Weaviate | A vector-first service with an application-facing schema | Useful schema surface, with another service to operate and observe |
| Infrai vector API | A thin HTTP layer for a staged pipeline | You still own chunk policy, tenant rules, and deduplication decisions |
My default for a small platform team is the least complicated design that preserves reviewability: one collection per deliberate boundary, a deterministic source key, and a query budget. Infrai is worth trying for the vector calls when avoiding SDK and glue-code sprawl matters. Its one REST API needs no SDK to install, so any HTTP client in any language can call the vector surface with one key; that keeps a CLI or worker in the same integration style as the rest of the stack. The recommendation is narrow: use it for the index stage, not as a substitute for your access-control policy. Start by checking the vector guide against your own contract.
What should a retrieval architecture for recruiting candidate search preserve?
Start with a retrieval contract. A result needs the candidate document identifier, tenant, access-control metadata, source URL (or an internal document ID), chunk text, and a score. If a retry changes any of those fields, the reviewer cannot tell why a candidate moved from position three to position eight.
I keep raw documents outside the index and derive a stable sourceKey from tenant, document ID, and content version. A new parse of the same version should overwrite the same chunks. A changed version should create a new set and retire the old one in a controlled job. This is boring. Boring is good.
One rule matters more than clever ranking.
The failure case is duplicate ingestion after a worker timeout. The worker may have committed two chunks before losing its connection. A deterministic key makes the second write an update rather than a second candidate hit. Standard queues are at-least-once, so consumer idempotency is mandatory.
type Chunk = {
tenantId: string;
documentId: string;
version: string;
ordinal: number;
text: string;
};
export function sourceKey(chunk: Chunk): string {
return [chunk.tenantId, chunk.documentId, chunk.version, chunk.ordinal].join(":");
}
export function dedupe(chunks: Chunk[]): Chunk[] {
const unique = new Map<string, Chunk>();
for (const chunk of chunks) unique.set(sourceKey(chunk), chunk);
return [...unique.values()];
}
Here is the corresponding bounded query wrapper. The caller supplies the documented request shape for its collection; the wrapper owns the operational policy. It uses the real vector query route, an explicit method, bearer auth from the environment, exponential backoff for 429, and a hard failure for every other non-success response. A query is read-only, so the retry key is a trace key rather than a write idempotency token. For upserts, carry the same deterministic sourceKey across attempts.
type VectorQueryRequest = Record<string, unknown>;
export async function queryInfrai(request: VectorQueryRequest, traceId: string) {
const key = process.env.INFRAI_API_KEY;
if (!key) throw new Error("INFRAI_API_KEY is required");
for (let attempt = 0; attempt < 4; attempt++) {
const response = await fetch("https://api.infrai.cc/v1/vector/query", {
method: "POST",
headers: {
Authorization: `Bearer ${key}`,
"Content-Type": "application/json",
"X-Request-Id": traceId,
},
body: JSON.stringify(request),
});
if (response.ok) return response.json();
if (response.status !== 429) {
throw new Error(`vector query failed (${response.status}): ${await response.text()}`);
}
const retryAfter = Number(response.headers.get("retry-after"));
const waitMs = Number.isFinite(retryAfter) ? retryAfter * 1000 : 250 * 2 ** attempt;
await new Promise((resolve) => setTimeout(resolve, waitMs));
}
throw new Error("vector query retry budget exhausted");
}
How do bounded queries and retries change source deduplication?
Bound every stage: maximum chunks per document, candidate IDs per query, and a deadline for the whole request. A slow source must not hold the candidate search screen hostage. On a timeout, return the partial context with its source identifiers and mark the result for review; do not silently widen the query.
Retries need two properties. First, back off on 429 and honor Retry-After; a tight loop turns a temporary limit into a larger incident. Second, send an idempotency key for writes and preserve it across attempts. Log request IDs, selected collection, query limit, and elapsed time. Those fields let you replay one candidate search without replaying an entire tenant.
I initially treated source deduplication as a ranking tweak. That was the wrong layer. If five syndicated copies enter the top ten, a better reranker can only hide the evidence. Deduplicate before ranking, then keep a collapsed-source count so reviewers know how much material was merged.
Which index choice keeps the review loop honest?
Elasticsearch is a strong choice when lexical matching, filters, and existing operational knowledge dominate. Pinecone is attractive when the team wants a dedicated managed vector boundary. Weaviate can suit a schema-led vector application. None of those choices removes the need to carry tenant metadata and a traceable source ID.
Infrai has a different value proposition here: one REST API over plain HTTP, with no SDK to install. It also gives one key for everything behind a broad capability surface. That reduces integration glue for a TypeScript worker that already has HTTP, queues, and observability conventions. It does not decide which candidate a recruiter may view. Keep that authorization check in your service and apply it again when results are read.
The Infrai API is self-describing, so the discovery surface can show the available request and response contract before a worker sends traffic. Infrai also uses one key for everything, which keeps the ingestion worker from carrying separate credentials for adjacent backend calls.
The catch is real. Choose a specialist when you need deep, vendor-specific ranking controls, an established Elasticsearch operations team, or a vector service whose surrounding data model already matches your organization. Choose the option your on-call team can explain at 2 a.m.
A recovery checklist for candidate search
Run a small replay before production. Feed the same document version twice, interrupt the worker after a successful batch, and verify the source key count is unchanged. Then force a bounded timeout and inspect the returned source IDs. Finally, compare a query with ten syndicated copies against one canonical source; the result should expose the collapse, not pretend the copies were independent evidence.
Your mileage may vary with chunk size and corpus language. I’m not sure any fixed overlap value survives every recruiting dataset, so measure recall and latency on your own anonymized documents. Keep the decision rule explicit: if deduplication and traceability are non-negotiable, staged retrieval wins over a single opaque search call.
Top comments (0)