← Back to Pull requests

support multi-dot partial search via index-side edge-grams #157

Closed
mj-palanker closed this pull request without merging on Jul 27, 2026 20:37 UTC
View on GitHub
mj-palanker mj-palanker commented on Jul 27, 2026 17:36 UTC
Author

Context

#139 made progressive typing of dotted identifiers work (ad.ph02t1.admin.se → ad.ph02t1.admin.securitygroup) by appending a : prefix operator to the last search term. On a prefix-dense index like ours (edge-grams mean every word contributes all its prefixes as lexemes), : forces GIN to range-scan and union the posting lists of every lexeme starting with the term — a trailing common token like prod turned a sub-second search into a 43s query on a 2.1M-row tenant (OPS-2310). #139 is reverted in the PR below this one; this PR restores the multi-dot matching it provided, keeping all queries as exact lexeme lookups.

Root cause of the original miss

jargon's tokenizer merges dotted segments (admin.securitygroup stays one token), so edge-grams were computed on the merged string and a bare sub-token gram like se (prefix of securitygroup) was never indexed. #139 papered over that at query time; this fixes it at write time.

Changes

  • Index side (normalizeVectorDocs): additionally emit edge-grams for each symbol-split sub-token (securitygroup → s, se, sec, …) at lowered weight. Purely additive — new vectors are a strict superset of old ones.

  • Query side (FullTextSearchQuery): build symbol-aware variants of the input — original, symbols→spaces (ad ph02t1 admin se), and symbols-deleted (adph02t1adminse) — each with its stemmed twin, deduped and OR'd as exact websearch_to_tsquery('simple', …) terms. No : anywhere. Inputs without symbols produce byte-identical queries to pre-#139 behavior.
  • Deployment properties

  • The joined variant matches joined-token prefix lexemes already present in existing indexes, so from-the-start dotted typing works immediately on old rows — no backfill required.

  • The split variant matches the new sub-token edge-grams on rows written after this change.

  • Known gap: mid-path partials (admin.se) won't match rows indexed before this change until they're rewritten or backfilled. (#139 covered this case at query time; accepted trade-off.)
  • Testing

  • TestSearchMultiDotPrefix restored verbatim from #139 (DB-backed, runs in CI).

  • New unit tests: sub-token edge-gram emission, dot-variant query construction, and a table-driven guard asserting generated queries never contain :.
  • Diff: 235 lines (+176 / -59) across 2 files Reviewer: None requested Review duration: 180m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.49) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.49 · 235 lines diff across 2 files
    0.49
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 10%
    57%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.327
    Shallow Review Depth shallow_review_depth
    0.289
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #157"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    mj-palanker mj-palanker
    Labels
    risk: low confidence: 58.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.1% (MEDIUM) · Higher = larger blast radius
    49.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.0% · Lower = rushed or shallow review
    58.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.6% · Safe to merge
    20.6%