Skip to content

search.ts uses inline ranking stubs — ranking/ modules implemented but never wired in #27

Description

@amondnet

Summary

src/search.ts uses inline ranking stubs instead of the fully‑implemented modules under src/ranking/. The ranking/{boosting,penalties,weighting}.ts files are complete and tested, but no non‑test code imports themsearch.ts re‑implements a reduced subset inline.

Evidence

  • src/search.ts:94applyQueryBoost is an identity stub (// Minimal stub — preserves identity): definition / stem / embedded‑symbol boosts are never applied.
  • src/search.ts:104rerankTopK does file‑saturation decay only, no path penalties (test/__init__/.d.ts/compat penalties skipped).
  • src/search.ts:38,52,88,98TODO(integration): replace with import from './ranking/...'.
  • grep ranking/ src --include=*.ts | grep -v test → only the TODO comments in search.ts; the real modules are dead code from search's perspective.
  • Implemented but unused: ranking/boosting.ts (applyQueryBoost, boostMultiChunkFiles, _boostSymbolDefinitions, _boostEmbeddedSymbols, _boostStemMatches), ranking/penalties.ts (rerankTopK, _filePathPenalty), ranking/weighting.ts (resolveAlpha).

Impact

Per CLAUDE.md the ranking pipeline order is RRF → multi‑chunk boost → query‑type boost (definition/stem/embedded‑symbol) → top‑k rerank with path penalties + saturation decay. Today only RRF + multi‑chunk boost + saturation run; the query‑type boosts and path penalties are silently missing, degrading result quality vs. semble.

Acceptance criteria

  • search.ts imports resolveAlpha from ranking/weighting.ts, applyQueryBoost + boostMultiChunkFiles from ranking/boosting.ts, and rerankTopK from ranking/penalties.ts.
  • Inline stub copies in search.ts (incl. _ALPHA_*, _SYMBOL_QUERY_RE, inline boostMultiChunkFiles/applyQueryBoost/rerankTopK) are removed.
  • Path penalties apply only when alphaWeight < 1.0, matching semble.
  • TODO(integration) comments removed; existing tests still pass (add coverage if the wired pipeline changes ordering).

Found during a stub audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p1Priority 1 - Hightype:bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions