Commit b972cf6
committed
feat(search): index the 16 package front pages, and pin the page-focus ranker
TWO CHANGES, both from building a real app against the MCP server and recording where
search failed.
1. THE PACKAGE FRONT PAGES WERE INVISIBLE. search-corpus.js excluded everything under
/api/, correctly for the 1,152 symbol pages — the feed already carries each symbol's
name, kind, package and summary, and deriving that twice once produced 52% junk. But
the rule matches on URL, and /api/<pkg>/latest/ is a different kind of page: an
overview naming the entry points, a Remarks section stating the behaviours no
signature shows, and worked examples.
Those 16 URLs got ONE record whose entire searchable text was a title and a
one-liner — 98 characters for @imqueue/http-protect, against 123 for a single one of
its properties. So "protect an HTTP gateway from too many requests per IP" returned
four HttpProtect PROPERTY pages, each with a summary mentioning requests and IPs,
while the page holding `app.use(new HttpProtect().jsonMiddleware())` never appeared.
A property page outscored the front page of the package because it had more indexed
text than the front page did. The `hardening` topic of the question KPI scored 0% on
BOTH rankers for the same reason: what answers it was not in the corpus.
Sections only, not a page record — the feed already contributes a `package` record
for each of those exact URLs, and a second record would leave the ranker's URL dedupe
choosing between two spellings of one page.
Cost: 719 -> 836 sections, search-text.json 206.9 -> 241.4 KB gz, on a feed fetched in
the background after the first query rather than on load. check:search-index now
validates 700 section ranges against the real mirrors, up from 599, and those pages
are dense with code fences.
2. THE RANKER NOW JUDGES A SECTION BY ITS PAGE (submodule -> 3a43ea0). Natural micro
94.1 -> 94.2 and macro 88.9 -> 89.0 with 19 better against 7 worse; question accuracy
64.0 -> 64.5, macro 60.9 -> 61.5, #1-exactly 47.8 -> 48.7; artificial 91.1 -> 90.8.
See that commit for the mechanism and for the two experiments rejected on the way.
Honest note on (1): measured alone it moved no aggregate — natural, artificial and
question all within 0.2 either way. It is kept because the content genuinely belongs in
the index and individual answers do improve (/api/validation/latest/#remarks went from
absent to #2 for "how do I reject bad input before it reaches my method?"), and because
nothing can rank a page whose text was never indexed. The aggregate needs the weights,
which is what (2) starts on.1 parent 5d7d7b1 commit b972cf6
2 files changed
Lines changed: 32 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
562 | | - | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
563 | 586 | | |
564 | 587 | | |
565 | 588 | | |
| |||
588 | 611 | | |
589 | 612 | | |
590 | 613 | | |
591 | | - | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
592 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
593 | 622 | | |
594 | 623 | | |
595 | 624 | | |
| |||
Submodule search-ranker updated 1 file
0 commit comments