Skip to content

Search: stop words, phrase bonus, group order, compounds, plural, relaxed queries - #310

Merged
oblomov-dev merged 2 commits into
mainfrom
claude/festive-mayer-et0gy6
Sep 11, 2026
Merged

Search: stop words, phrase bonus, group order, compounds, plural, relaxed queries#310
oblomov-dev merged 2 commits into
mainfrom
claude/festive-mayer-et0gy6

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

What

Five ranking defects in the search box, each measured on the real index before the change and pinned in test/search.test.mjs:

  • Stop words are not search terms while a real word is left. "how do i install" answered with Client API › check_on_init and Installation was not in the first four: a, i, to, do are a prefix of something in every entry and each earned a title-hit's worth of points. Terms of one or two letters (ui, f4) count at a word start only.
  • The words next to each other earn a bonus. "abap cloud" preferred Toolchain › abap-cleaner over the heading "ABAP Cloud"; "abap unit" the same.
  • Groups come in the order of their best hit. "dialog" opened on Value Help, Popup, PDF and Lock (four pages that mention the word) above 47 samples that are dialogs. The documentation still leads whenever it has a real answer.
  • A field is also matched with its spaces taken out (terms of five letters and up), so "messagebox" finds the heading "Message Box" with its anchor and "selectdialog" the Select Dialog sample. The plural s comes off before the prefix match: "tables" found 33 entries, "table" 202.
  • Nothing found is not the end. The rarest word is set aside, then the next; a single word that still finds nothing is tried one edit away against the title words ("tabel" → "table", and the candidate with the reader's first letter wins over "label"). The box says above the rows what it answered instead (hits.relaxedTo). Synonyms are data in the index builder (SYNONYMS in scripts/lib/search-index.mjs: readonly → editable, f4 → value help, …), added to terms so the alias finds the entry and the ranking stays with the entry's own words.

Files

  • docs/.vitepress/theme/search-engine.js — the matcher (the playground's copy is brought in step in abap2UI5/playground)
  • docs/.vitepress/theme/SearchBox.vue — the "Nothing matches X — showing Y" line, highlight of the query that answered
  • scripts/lib/search-index.mjsSYNONYMS, enrich( )
  • test/search.test.mjs — nine new tests
  • AGENTS.md — the rules and the reasons

Verification

  • npm test: 245/245
  • The index is unchanged in size (synonyms add ~2 kB); a query over 932 entries takes ~1 ms

🤖 Generated with Claude Code

https://claude.ai/code/session_017JMbwNQAZ65yn4GrgRdvsi


Generated by Claude Code

…axed queries

Five ranking defects measured on the real index, each pinned in
test/search.test.mjs:

- "how do i install" answered with Client API > check_on_init: `a`, `i`,
  `to`, `do` are a prefix of something in every entry and each earned a
  title-hit's worth of points. Stop words are no longer search terms while
  a real word is left.
- "abap cloud" preferred abap-cleaner over the heading "ABAP Cloud": the
  words next to each other now earn a bonus.
- "dialog" opened on four pages that mention the word above 47 samples
  that are dialogs: groups come in the order of their best hit, the
  documentation leading only when it has a real answer.
- "messagebox" missed the heading "Message Box", "tables" found 33 of 202:
  a field is also matched with its spaces taken out, and a plural `s` is
  taken off before the prefix match.
- "tabel" and "readonly" found nothing: a query that finds nothing sets
  the rarest word aside, then tries one edit away against the titles, and
  the box says what it answered instead; synonyms are data in the index
  builder (readonly -> editable, f4 -> value help, ...).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017JMbwNQAZ65yn4GrgRdvsi
Three links at the left edge under three boxes that span the width read
as a fourth thing that did not get finished. In the published stylesheet
and in VitePress's copy of the rule.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017JMbwNQAZ65yn4GrgRdvsi
@oblomov-dev
oblomov-dev merged commit 7da9d70 into main Sep 11, 2026
1 check passed
@oblomov-dev
oblomov-dev deleted the claude/festive-mayer-et0gy6 branch September 11, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants