Skip to content

Commit 5867797

Browse files
committed
fix(search): nobody types the sigil, so lastSeg should not require it
`lte` ranked 27th for `FilterInput.$lte` behind 26 titles that merely contain those three letters inside aLTErnative and fiLTEr: /compare/ at 700, FilteredChannels 565, FILTER_OPS 550, against the target's 438. The same shape as "rate" leading with generate_client. The cause was not the matcher. W.lastSeg exists for exactly this query — "send" for RedisQueue.send, 700 points, the strongest applicable signal — but the last segment of `filterinput.$lte` folds to `$lte`, which never equals `lte`. The record fell through to W.substring at 320 and lost to containment. The sigil is TypeScript's, not the reader's. Comparing sigil-insensitively covers `$lte`, `$gte`, `$in` and `_default`: 77 of 1,152 API records have a sigil-prefixed last segment. Two grading attempts came first and are recorded because both looked right and neither worked. Grading scanFor so `\blte\b` outscores `[a-z]lte[a-z]` moved it only 27 -> 14 and cost natural macro 0.1. Grading W.substring the same way did nothing at all: `direct` is a Math.max over the element score, and for a long title the element score already exceeds 320, so the substring weight was never what decided it. The lever was a signal that was missing, not one that was mis-weighted. master after recall@6 (agents) 97.2% 99.5% regressions vs MCP 69 0 natural micro/macro 94.0/88.9 94.0/88.9 0 queries better, 0 worse artificial 89.9/94.5 91.2/95.4 376 better, 1 worse artificial #1 exact 73.8% 77.6% Zero: the site ranker now matches or beats rankEntries on every one of the 3,657 agent-shaped queries. One judgement call for review: "default" now returns async-logger's `_default` first, which the user previously said was less useful than what it returned before. No natural query moved, so nothing real regressed, but the behaviour is deliberate and worth a second opinion.
1 parent 9ef7619 commit 5867797

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/_shared/js/search.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,11 @@
412412
return folded.replace(/[^a-z0-9]/g, "");
413413
}
414414

415+
// Leading sigils a caller never types: `$lte`, `_default`, `#private`.
416+
function sigilless(segment) {
417+
return segment.replace(/^[^a-z0-9]+/, "");
418+
}
419+
415420
function lastSegment(name) {
416421
var parts = String(name).split(".");
417422

@@ -875,7 +880,12 @@
875880

876881
if (lower === q.joined) {
877882
direct = W.exact;
878-
} else if (fold(lastSegment(lower)) === q.joined) {
883+
} else if (sigilless(fold(lastSegment(lower))) === q.joined) {
884+
// Sigil-insensitive, because nobody types the sigil. `FilterInput.$lte` is exactly what
885+
// lastSeg exists for — "send" for RedisQueue.send — but its last segment folds to `$lte`,
886+
// which never equalled `lte`, so the record fell through to W.substring and ranked 27th
887+
// behind 26 titles that merely contain those letters inside aLTErnative and fiLTEr.
888+
// Same for `_default`, `$gte`, `$in`: the sigil is TypeScript's, not the reader's.
879889
direct = W.lastSeg;
880890
} else if (lower.indexOf(q.joined) === 0) {
881891
direct = W.prefix;

0 commit comments

Comments
 (0)