mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-12 07:58:49 +00:00
378f519231
Search page results always linked to the best-scoring section's anchor whenever a snippet was shown, so clicking a result whose page title matched the query would drop the user to a heading partway down the article instead of the top. Link to the top of the page when the query is a page/title match (every query word appears in the title) and keep the section anchor only for genuine section-level matches. Adds a pure `isPageTitleMatch` helper with unit tests, mirroring the per-word title matching already used for scoring in reciprocalRankFusion. RND-11916 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xihqNNfTuEzwsux5wzMoF