Opportunity-search core¶
Current flow¶
search_opportunities_process accepts validated OpportunitySearchCriteria
rather than a free-form MongoDB dictionary.
- Build the tenant/user hard filter from the same JOM configuration used by matching processing.
- Normalize requested skills and load the user's matching scores.
- If no scores exist at all, run one guarded user-opportunity recalculation; do not recalculate when existing scores were only excluded by “show more”.
- Intersect profile matches with explicit criteria when filters are present.
- Fill an undersized result set with a deterministic full-text/vector search.
- Run those independent searches concurrently and fuse their ranked lists locally with weighted RRF.
- Optionally rerank fallback offers against the user's attached job title using
InferredTitle_embeddings. - Format structured suggestions, persist returned IDs in state and emit safe streaming sub-steps.
Hard filters, exclusions and explicit user criteria are kept distinct so the search cannot accidentally broaden tenant visibility rules.
Index dependencies¶
The flow queries JobOffers through opportunities_autocomplete and the
combined embeddings_index. See MongoDB indexes.