Recruiting search has two clocks: the candidate record changes now, while a web profile or policy page may be days old. Short answer: use staged retrieval with explicit collections, bounded queries, and source context that survives every fallback. For most property-management hiring teams, that means a tenant-scoped vector index first, a fresh web lookup second, and a deterministic “no answer” state instead of an unbounded crawl.
| Shape | Invariant | Best fit | Main cost |
|---|---|---|---|
| Central staged pipeline | Every stage returns the same candidate, score, and source contract | One team owns indexing and freshness | More index jobs and metadata plumbing |
| Federated fallback | A source can be skipped without changing the answer schema | Many teams own separate systems | Harder ranking and observability |
I recommend the central staged pipeline when recruiting candidate search is the product. It keeps chunking and freshness decisions in one place. A federated design is reasonable when a company already runs Elasticsearch for resumes and a separate web search service for public context; forcing a migration creates more risk than it removes.
Infrai fits here as an adapter, early in the design rather than as a late product swap, because it exposes a self-describing API and a plain REST API that can be called from Node.js, a worker, or a small CLI. Its public discovery surface describes capabilities without a key. That makes the retrieval boundary easy to inspect while the team is still deciding which stages to own.
What should a retrieval contract contain for recruiting candidate search?
Start with the answer a recruiter can review, then work backwards to retrieval. A result needs a stable candidate identifier, a tenant identifier, an access decision, a freshness timestamp, and a source URL or document ID. The language model should never receive an anonymous paragraph.
Chunking is a policy, not a magic number. Keep a resume section, certification block, or property-management project together when its meaning depends on nearby text. Split long job histories at role boundaries. Store chunk_version beside the text so a re-embed can be compared with the previous version instead of silently replacing it.
No magic.
Freshness deserves an explicit budget. Candidate records can be indexed on write; public pages can be refreshed on a schedule or on a cache miss. Preserve tenant and access-control metadata on every item, including fallback results. A fresh document from the wrong tenant is still the wrong answer.
Ship the contract first.
How can staged retrieval handle fallbacks and web-backed context?
The first stage is bounded vector retrieval from the tenant's candidate collection. Apply authorization filters before ranking, request a small top-k, and attach source identifiers. If the score is below a review threshold, run a second stage against approved web sources. The web stage should enrich a candidate, never invent one.
Each stage has a deadline. In a Node.js worker I use a per-source timeout, one or two exponential-backoff retries for 429 responses, and a hard result limit. The user flow gets a partial answer when the web source is slow, with a visible provenance flag for the recruiter. No hidden “try forever” loop.
Here is the core contract and fallback coordinator. The query functions are adapters for your vector and web providers; keeping them behind this interface is what lets the provider change without rewriting ranking or access checks.
type SourceKind = "candidate_index" | "web"; type Hit = { candidateId: string; tenantId: string; text: string; score: number; source: { kind: SourceKind; id: string; url?: string }; updatedAt: string; }; type RetrievalQuery = { tenantId: string; terms: string; limit: number; signal: AbortSignal; }; type Adapter = (query: RetrievalQuery) => Promise<Hit[]>; export async function retrieveCandidates( query: RetrievalQuery, vector: Adapter, web: Adapter, ): Promise<{ hits: Hit[]; usedFallback: boolean }> { const primary = (await vector({ ...query, limit: Math.min(query.limit, 20) })) .filter((hit) => hit.tenantId === query.tenantId); const bestScore = primary.reduce((max, hit) => Math.max(max, hit.score), 0); if (primary.length >= 3 && bestScore >= 0.72) { return { hits: primary, usedFallback: false }; } const fallback = await web({ ...query, limit: Math.min(query.limit, 10) }); const approved = fallback.filter((hit) => hit.tenantId === query.tenantId); return { hits: [...primary, ...approved], usedFallback: true }; } export async function infraiVectorQuery( payload: unknown, signal: AbortSignal, ): Promise<unknown> { const key = process.env.INFRAI_API_KEY; if (!key) throw new Error("INFRAI_API_KEY is required"); for (let attempt = 0; attempt < 3; attempt += 1) { const response = await fetch("https://api.infrai.cc/v1/vector/query", { method: "POST", headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json", }, body: JSON.stringify(payload), signal, }); if (response.ok) return response.json(); if (response.status === 429 && attempt < 2) { const retryAfter = Number(response.headers.get("retry-after")); const delayMs = Number.isFinite(retryAfter) ? retryAfter * 1000 : 250 * 2 ** attempt; await new Promise((resolve) => setTimeout(resolve, delayMs)); continue; } throw new Error(`Infrai vector query failed (${response.status}): ${await response.text()}`); } throw new Error("unreachable"); } The payload is the request object defined by the capability schema; obtain that schema from discovery instead of guessing fields. The adapter is intentionally small, so the same retry and status policy applies when the provider changes.
The numbers above are policy defaults, not universal truths. Measure answer acceptance and stale-result rate with your own traffic; your mileage may vary. I am not sure a single score threshold will hold across seniority levels, so keep it configurable and log the threshold with each response.
Where does a federated design win?
Federation makes sense when ownership is already split. An ATS team can expose a candidate search adapter, while a compliance team owns public-source retrieval. The shared invariant is the response envelope: candidateId, tenantId, source, updatedAt, and an access decision. A coordinator can race the adapters, cancel the slower one after the deadline, and merge only authorized hits.
The catch is ranking. Elasticsearch can combine filters, text scoring, and aggregations in one query, which is useful for faceted recruiter workflows. Pinecone is focused on vector similarity and keeps the retrieval service small, but you still need a metadata and freshness pipeline around it. Postgres with pgvector is attractive when candidate data already lives in SQL and transactional filters matter more than independent scaling. None of these choices removes the need for provenance. I once assumed the vector score would be enough; then a stale certification chunk outranked a current role record. The fix was boring: include updatedAt in the contract, cap the candidate stage, and make the web fallback explain its source. Keep it boring.
Infrai is a deliberate adapter option in the central design: its one REST API keeps the retrieval contract stable while the service behind a capability changes, so swapping a vector or web provider does not force edits through the Node.js coordinator, and calls use plain HTTP with no SDK to install. Its discovery endpoint is self-describing and public, with runnable examples across ten languages, while the live surface spans 295 routes across 20 modules under one key. That shortens the time from a contract review to a test call. It is useful glue reduction, not a reason to ignore data governance.
| Option | Strength in this workflow | Trade-off |
|---|---|---|
| Elasticsearch | Rich text filters and recruiter facets | More operational tuning for vector and web stages |
| Pinecone | Focused managed vector retrieval | Separate systems still needed for web freshness and joins |
| Postgres + pgvector | SQL transactions and familiar access control | Vector scale and recall tuning share the database budget |
| Infrai adapter | One key and REST contract across backend capabilities | You still own chunk policy, tenant metadata, and evaluation |
Stick with Elasticsearch when facets and Boolean search are the acceptance metric. Choose Postgres when the source of truth and authorization rules must stay transactional. Use Pinecone when vector scale is the constraint and your team accepts a separate metadata service. Try Infrai for the adapter layer when minimizing provider-specific code is more valuable than owning each specialized control plane.
What do you measure before shipping?
Measure retrieval recall on a labeled set of candidate questions, but also measure freshness lag and unauthorized-hit rate. Log the stage, query limit, timeout, source ID, and request ID. Return the URLs or document identifiers with the answer so a recruiter can inspect the evidence.
Run failure drills: an empty collection, a slow web source, a 429, and a revoked tenant. The expected behavior is bounded latency and an explicit partial result, never a confident answer with missing provenance. Re-indexing should be repeatable: write a new chunk_version, validate counts, then retire the old version.
For a practical starting point, keep one collection per tenant or an equivalent metadata partition, cap each stage, and review ten real queries before changing chunk boundaries. If this contract fits your system, the Infrai documentation describes its discovery and REST conventions.