Repository navigation
Description
Problem Statement
The OASF extractor groups its matches into score tiers — tier 1 is the closest group of matches, tier 2 the next closest, and so on. The SDK returns one tier by default, and dir inherits that everywhere the extractor is used: import enrichment, dirctl search, routing search, and (soon) the extractor-backed endpoints.
One tier is too narrow in practice. A query like "cloud computing" returns nothing against a node that holds four records tagged with cloud-related skills, because the single closest group misses classes that are obviously relevant to the phrase. The taxonomy is hierarchical and densely populated, so the gap between the closest group and the next is often not meaningful.
Proposed Solution
Introduce a platform-wide default of two tiers, applied consistently by every backend and consumer:
// DefaultTiers is the number of score tiers the extractor returns per kind when
// a caller does not set ExtractOptions.Tiers.
const DefaultTiers = 2ExtractOptions.Tiersunset (0) resolves toDefaultTiersin both the local and remote backends, so the two stay in lockstepnlsearch.Decomposeapplies the same ceiling when filtering signals, so it cannot disagree with what the backend returned- Callers can still narrow (
Tiers: 1) or widen per call
An implementation already exists on the feat/api-post-search branch (commit eaf84c6a) and can be lifted directly.
Why this is its own issue
It is a small diff with cross-cutting behavioral reach — it changes what dirctl import writes into records, what dirctl search and routing search match, and what the extractor-backed endpoints return. It deserves its own review and its own revert point rather than riding along inside an endpoint PR.
It also unblocks #2001, whose description already assumes extractor.DefaultTiers exists.
Decided
One default everywhere: tier 2. Import enrichment, dirctl search, routing search, and the extractor-backed endpoints all use DefaultTiers = 2. A single platform-wide constant was chosen over splitting import from search, so behaviour stays predictable and there is one number to reason about.
Noted for later, not blocking: enrichment persists the classes it assigns into records, so correcting them means re-importing, whereas a loose search match costs nothing. If tier 2 turns out to be noisy for enrichment specifically, revisit splitting the two rather than lowering it everywhere.
Still open (non-blocking):
- Constant or configurable? A
constis the simplest thing that works. Server config would be the place if operators should tune recall per deployment. - Is 2 the right number? Chosen from one observed failure (tier 1 returning nothing for a plainly relevant query), not from measurement. The spot-check below is the first real evidence either way.
Acceptance criteria
-
extractor.DefaultTiersapplied consistently by the local and remote backends and bynlsearch.Decompose - Callers can override per call in both directions
- Unit tests covering the default, an explicit narrowing override, and backend/decompose agreement
- Spot-check on a seeded node that previously-empty descriptive queries return sensible matches, and that tier-2 results are not obviously noisy
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(extractor): default to two score tiers
feat(extractor): move the OASF extractor to utils and unify resolutio…