fix(pgdb): symbol-aware FTS query variants (no :* operator) #167
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.47) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 177 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 10%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.310
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 #167"
general
weight: 0.35
ianeustis
What & why
FullTextSearchQuerystripped every non-alphanumeric rune, so queries likeResearch_&_Developmentcollapsed to the single trailing tokenresearch— and trailing-token prefix matching made the search return everything alphabetically starting with "Research" (ConductorOne IGA-4267). The index side already holds the split lexemes (research,development) and joined lexemes (researchdevelopment); only the query side was wrong.Change (query-side only, no index/reindex)
FullTextSearchQuerynow builds three variants of the input oversymbolQuerySplitChars={. _ / -}:Research_&_Development→research development),Research-Development→researchdevelopment),runs each through the existing tokenize/lowercase/fold/strip pipeline, adds each variant's stemmed counterpart (
stemmer.English), dedupes, and ORs them all as exactwebsearch_to_tsquery('simple', ?)terms.Semantics locked by tests
:prefix operator anywhere (guard test over multi-word, dotted, slashed, snake_case, unicode inputs) — the prefix operator caused pathological GIN scans.&needs no special handling: jargon tokenizes it as a separator per-token, so orig/split/joined dedupe to the same string and only the stemmed counterpart differs.Research_&_Developmentrenders(websearch_to_tsquery('simple', 'research development') || websearch_to_tsquery('simple', 'research develop'))— the AND variant matches the exact index entry (research+developmentlexemes).-(and/,.)** yield a distinct joined variant:Research-Developmentrenders all four terms (research development,research develop,researchdevelopment,researchdevelop), proving both dedup and the joined path.R&Drenders a single(websearch_to_tsquery('simple', 'r d'))arg.Index-side files (
normalizeVectorDocs,symbolsSubTokensSplitDoc,symbolsFullTokensSplitDoc, schema, key_builder, templates) are untouched — query-side fix only. Test helperrenderQuerySQLand the DotVariants/NoPrefixOperator tests are ported from556561c;TestFullTextSearchQueryUnderscoreAmpersandlocks the verified renderings above.Verification
go test ./pgdb/v1/ -run 'TestFullTextSearchQuery|FuzzFullTextSearchQuery'→ ok (DB-backed tests need a postgres binary and are filtered out by the-runpattern).Downstream
ConductorOne carries this port as a vendored-only fallback in ductone/c1#25548 (query-only; go.mod bump follows this merge).