Skip to content

Show matched alias in navbar search preview#3922

Merged
Simrayz merged 2 commits intomasterfrom
feat/3880-show-alias-if-matched-in-search-results
Mar 26, 2026
Merged

Show matched alias in navbar search preview#3922
Simrayz merged 2 commits intomasterfrom
feat/3880-show-alias-if-matched-in-search-results

Conversation

@Simrayz
Copy link
Copy Markdown
Contributor

@Simrayz Simrayz commented Mar 25, 2026

Scope and purpose

Fixes #3880.

When rooms/locations are found via alias search, the matched alias is now displayed (highlighted) in the navbar search preview, so users can see why a result appeared.

This pull request

  • adds a highlight template filter for wrapping query matches in <mark> tags
  • extends SearchResult to carry an optional matched alias
  • displays the matched alias in navbar search results

Screenshots

Location Room
image image

Contributor Checklist

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • Wrote the commit message so that the first line continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • Based this pull request on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If it's not obvious from a linked issue, described how to interact with NAV in order for a reviewer to observe the effects of this change first-hand (commands, URLs, UI interactions)
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

@Simrayz Simrayz requested review from a team and johannaengland March 25, 2026 14:02
@Simrayz Simrayz self-assigned this Mar 25, 2026
@Simrayz Simrayz marked this pull request as ready for review March 25, 2026 14:07
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Test results

    13 files      13 suites   24m 45s ⏱️
 2 943 tests  2 943 ✅ 0 💤 0 ❌
17 214 runs  17 214 ✅ 0 💤 0 ❌

Results for commit c38bc8c.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.98%. Comparing base (2982810) to head (54ac1fa).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3922   +/-   ##
=======================================
  Coverage   63.97%   63.98%           
=======================================
  Files         627      627           
  Lines       46348    46362   +14     
  Branches       43       43           
=======================================
+ Hits        29653    29665   +12     
- Misses      16685    16687    +2     
  Partials       10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to go IMHO.

If I have to nitpick (and I will): I subscribe to the stepdown rule, (where it can be applied within the constraints of the programming language in use): The _find_matching_alias() function is a much lower-level concept then the high-level search provider concepts in the file, so it should be defined much further down in the file (I actually trained my Claude Code to adhere to this so I don't have to nitpick it whenever I asked Claude to produce something 😆 )

Not a show-stopper, though...

)


def _find_matching_alias(aliases, query):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should find all matching aliases. I know that it is quite an edge case where two aliases (or more) match an entered query, but if it matches multiple aliases then all should then be shown in the dropdown

@Simrayz Simrayz force-pushed the feat/3880-show-alias-if-matched-in-search-results branch from 865a7bd to c38bc8c Compare March 26, 2026 08:39
Copy link
Copy Markdown
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done

@Simrayz Simrayz force-pushed the feat/3880-show-alias-if-matched-in-search-results branch from c38bc8c to 54ac1fa Compare March 26, 2026 09:33
@sonarqubecloud
Copy link
Copy Markdown

@Simrayz Simrayz merged commit 9660291 into master Mar 26, 2026
16 checks passed
@Simrayz Simrayz deleted the feat/3880-show-alias-if-matched-in-search-results branch March 26, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Only show alias of room/location in search preview if user searched using alias

4 participants