Add q param to algolia search, fix search term highlighting across html nodes#14080
Open
Add q param to algolia search, fix search term highlighting across html nodes#14080
Conversation
…h term is across multiple html nodes
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
vezwork
commented
Feb 20, 2026
| activateTabsWithMatches(mainEl); | ||
| // Let the browser settle layout after Bootstrap tab transitions | ||
| // before calculating scroll position. | ||
| requestAnimationFrame(() => scrollToFirstMatch(mainEl)); |
Contributor
Author
There was a problem hiding this comment.
this was moved inside of highlight
vezwork
commented
Feb 20, 2026
Comment on lines
-365
to
-369
| const fullMatches = item.text.matchAll(/<mark class='search-match'>(.*?)<\/mark>/g) | ||
| // extract capture group with the search match | ||
| // result e.g. ["def fiz"] | ||
| const searchMatches = [...fullMatches].map(match => match[1]) | ||
| if (searchMatches[0]) { |
Contributor
Author
There was a problem hiding this comment.
We no longer use the matching text in the search, like we did for text fragments. Instead, for the q param, we use the user's full query, exactly as they typed it, whether algolia found a match or not. Algolia doesn't always find matches that the highlighting can, so this should help the user find anything that matches what they typed.
vezwork
commented
Feb 20, 2026
| // After search highlighting, activate any tabs whose panes contain <mark> matches. | ||
| // This ensures that search results inside inactive Bootstrap tabs become visible. | ||
| // Handles nested tabsets by walking up ancestor panes and activating outermost first. | ||
| function activateTabsWithMatches(mainEl) { |
Contributor
Author
There was a problem hiding this comment.
Replaced with openAllTabsetsContainingEl
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.
Examples
I highlighted and copied some text on various pages that spans decorated and undecorated text, then pasted it into algolia search, and these are the successful matches:
Description
This PR
q={search term}param, enabling multiple match highlightingI referenced @cderv's PR #14053 while finishing this PR. Building off of that, I found a method for opening containing tabsets that requires significantly less code. See
openAllTabsetsContainingEl