Short answer: treat recruiting candidate retrieval as a versioned handoff, where every result carries permission, freshness, and an openable citation before it reaches a recruiter.
I run a one-person SaaS, so my scarce resource is attention. A release that somebody else cannot replay becomes my support queue. The useful decision is therefore not “which index scores highest?” It is “can the next engineer, or my future self, reproduce this answer and roll it back?”
Candidate search has two clocks. The source system changes when a resume or profile changes; the search index changes when ingestion catches up. If those clocks are invisible, a recruiter can receive a plausible result backed by an old document. Similarity does not establish current truth.
I make each indexed revision carry a stable candidateId, revision, sourceUrl, sourceUpdatedAt, tenant, and visibility policy. A content hash makes retries idempotent. The serving path accepts a query and actor, applies tenant and role filters, and returns an evidence span with the hit. Deletion and expiry are state transitions, not cleanup chores.
One small rule saves a lot of arguing: no citation, no result.
This contract also makes a handoff testable. A fixture can publish revision 3, delay the index, then publish revision 4 and verify that a late event cannot replace newer evidence. A revoked recruiter must disappear from results, snippets, facets, and logs. I do not need a clever model to test those invariants.
How can a Node.js retrieval build make release handoffs reproducible?
The smallest useful implementation keeps policy outside the search engine. Lexical retrieval catches exact certifications and acronyms; dense retrieval catches wording such as “queue consumer” and “message worker.” Reciprocal rank fusion can combine the two while the team is still collecting labels.
type CandidateHit = {
candidateId: string;
revision: number;
text: string;
citation: string;
sourceUpdatedAt: string;
tenantId: string;
visibility: string[];
score: number;
};
export async function retrieve(
query: string,
actor: { tenantId: string; role: string },
deps: {
lexical: (q: string) => Promise<CandidateHit[]>;
dense: (q: string) => Promise<CandidateHit[]>;
},
): Promise<CandidateHit[]> {
const [lexical, dense] = await Promise.all([
deps.lexical(query),
deps.dense(query),
]);
const newest = new Map<string, CandidateHit>();
for (const hit of [...lexical, ...dense]) {
if (hit.tenantId !== actor.tenantId) continue;
if (!hit.visibility.includes(actor.role)) continue;
if (!hit.citation || !hit.sourceUpdatedAt) continue;
const prior = newest.get(hit.candidateId);
if (!prior || hit.revision > prior.revision || hit.score > prior.score) {
newest.set(hit.candidateId, hit);
}
}
return [...newest.values()].sort((a, b) => b.score - a.score).slice(0, 20);
}
The function is intentionally boring. It does not claim that a score is a hiring recommendation. It makes the handoff artifact inspectable: inputs, revision, policy decision, and citation can be logged with a request ID while raw resume text stays out of telemetry.
What belongs in the release handoff for candidate search?
I attach these checks to the pull request and to the indexer deployment:
- Evidence: every hit includes a source span, URL, and update timestamp; the URL opens with the caller's least-privilege account.
- Authorization: tests cover two recruiter roles and a revoked user. Hidden data cannot leak through snippets, facets, or debug logs.
- Freshness: advance a fixture beyond the policy window and confirm it is excluded until an approved revision is indexed.
- Revision safety: replay events out of order and confirm the newest approved revision wins; retrying the same event changes nothing.
- Recall and precision: label title synonyms, spelling errors, empty queries, and must-have constraints. Review the top 20 manually instead of treating similarity as truth.
- Operations: record query latency, empty-result rate, filter rejections, and index lag. Compare with the previous release baseline.
The handoff should include one deliberately bad match and one deliberately missing match. Those examples teach the next person what the system refuses to hide. I've found that a concrete replay is easier to review than a dashboard: publish revision 3, queue revision 4, deliver the events backwards, and assert that revision 4 remains the answer.
Choosing the storage boundary without trapping the team
For a small service, keeping full-text search and vectors beside transactional candidate data reduces the number of handoffs. PostgreSQL text search and pgvector share operational ownership, but index growth competes with application resources. A separate search cluster gives more analyzer and ranking controls while adding a security model and another deployment surface. A ranking-focused engine supports deeper experiments, at the cost of more concepts to operate.
I choose based on the failure I can measure: missed exact skills, unacceptable latency, or an isolation requirement. A migration is a reversible experiment with a shadow index and a rollback pointer, not a rewrite justified by a benchmark screenshot.
| Approach | Interface | Onboarding cost | Best fit | Main limitation |
|---|---|---|---|---|
| PostgreSQL full text + pgvector | SQL | Low when data is already there | One transactional system | Search indexes compete with application resources |
| Elasticsearch hybrid search | REST or client library | Medium | Mature analyzers and filters | Separate cluster and security model |
| Vespa ranking engine | HTTP or client library | High | Complex ranking experiments | More operational concepts to own |
The trade-offs I would put in the release note
Hybrid retrieval costs more CPU and adds a merge path. Lexical-only search is a good fit when recruiters mostly use standardized titles, certifications, or candidate IDs. Dense retrieval helps with paraphrases, but it can surface a semantically related profile that lacks the required evidence. No ranking method guarantees a fair hiring outcome; historical labels can encode bias, and a citation proves provenance rather than correctness.
The catch is maintenance. This approach isn't suitable when the team cannot operate two retrieval paths or review access policies; keep a simpler lexical system until that process exists. Stick with a managed search boundary when on-call time is the binding constraint, and keep components close to the database when residency and query control matter more. Your mileage may vary on the freshness window because source and legal policy differ.
I ship weekly, but I outsource undifferentiated indexing plumbing only after the contract and replay tests are stable. That keeps revenue per hour pointed at product work while the release handoff stays defensible.
Top comments (0)