feat: Russian stemming and per-word ranking in MCP help search - #206
Merged
Merged
Conversation
docs_search found nothing for a question asked in full: the encoder kept every word form apart («подписка» vs «подписки»), and FlexSearch intersects query words, so an article had to contain all of them at once. The shared encoder now drops Russian stopwords and applies the Snowball Russian stemmer, which also shrinks the index (2.1 MB -> 1.5 MB). The worker uses its own search provider over the same index: each word is looked up on its own and articles are ranked by IDF and field weight, so a partial match still counts and a rare word outweighs a common one. The root flexsearch goes back to 0.7.43, the version the plugin builds the index with: 0.8 imports a 0.7 export silently and finds nothing. Refs Hexlet/hexlet#4364 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A hyphenated word («онлайн-курс») reached FlexSearch as one query of two terms, which it intersected again and scored twice. Refs Hexlet/hexlet#4364 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le index Derive the query stems once, declare the indexed fields once, and build snippets only for the results returned. A flexsearch version that doesn't match the plugin's now fails initialization instead of searching an empty index. Refs Hexlet/hexlet#4364 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The worker reads the index the plugin builds with flexsearch 0.7; `ncu -u` would bump the root dependency to 0.8, which imports that index silently and finds nothing. Refs Hexlet/hexlet#4364 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-search # Conflicts: # pnpm-lock.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Поиск MCP справки (
docs_search) находит статью по любой словоформе и по вопросу целиком. Hexlet/hexlet#4364, этап 0 из Hexlet/hexlet#4363.build: docusaurus-plugin-mcp-server indexer encode(text) lowercase, split + drop Russian stopwords # @orama/stopwords + Snowball Russian stemmer # @orama/stemmers: подписка/подписки/подписку → подписк worker: McpDocsServer - built-in flexsearch provider # whole query → FlexSearch → every word required + HelpSearchProvider # worker/search-provider.ts + each query word searched on its own + score = Σ idf(word) × field weight (title 3, headings 2, description 1.5, content 1)SearchProvider— поэтому провайдер, а не патч плагина.flexsearchвозвращён на 0.7.43 — на ней плагин собирает индекс; 0.8 читает такой индекс без ошибки и не находит ничего..ncurc.jsonне даётmake update-depsподнять его обратно, а провайдер при старте проверяет, что индекс находит статью по её заголовку, и иначе падает.Evidence
Размер
search-index.jsonПрогон вопросов (топ-3, вопрос целиком)
Исходные 20 вопросов из #4363 нигде не записаны, поэтому набор собран заново: 9 реальных вопросов из недавних
Обращение за помощьюи 13 сформулированных по темам существующих статей. Вторые невольно повторяют слова статей — оценка по ним завышена.Промахи — не морфология: «вернуть деньги» против «возврат» в статье; «что такое Рейтинг» перебивают заголовки «Что такое…».
Проверено:
make build,tscпо worker'у,wrangler dev+ JSON-RPCdocs_search— выдача совпадает с таблицей.Merge Danger
Door: two-way
Откат — revert; индекс пересобирается на каждом деплое.
Blast Radius: MCP-поиск
Меняется только
docs_searchуhelp.hexlet.io/mcp(lunr-поиск на сайте не тронут). Форма индекса провайдера повторяет плагин вручную: апгрейд плагина нужно проверять прогономdocs_search.🤖 Generated with Claude Code