Skip to content

Conversation

@adangel
Copy link
Member

@adangel adangel commented Sep 18, 2025

Describe the PR

Improves the integrated search in the documentation:

  • displays the results in a more readable way
  • allow to use simple keyboard shortcuts: press "s" to focus the search field, use arrow up/down to navigate the results
  • display the rule descriptions in the search results
  • as our rule names are using PascalCase, I split these into single words so that rules can be found by part of their name.
  • display 20 results and make it scrollable
  • disable fuzzy search. without it more understandable results are returned.

Old:
image

New:
image

Related issues

  • Fix #

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@adangel adangel added this to the 7.18.0 milestone Sep 18, 2025
@adangel adangel added the in:documentation Affects the documentation [doc] label Sep 18, 2025
@pmd-actions-helper
Copy link
Contributor

pmd-actions-helper bot commented Sep 18, 2025

Documentation Preview

No regression tested rules have been changed.

(comment created at 2025-10-24 12:59:21+00:00 for 8b0adeb)

@zbynek
Copy link
Contributor

zbynek commented Sep 18, 2025

The new layout is nice!

Two (Chrome/Windows specific?) issues: when search is not active, there is an empty search box:
image
When it is active, there are both vertical and horizontal scrollbars, even if they are not needed. Would it make sense to have just overflow-y: auto to fix both of these isues?

For renamed rules this gives the same description for both the new and the deprecated one -- it might be useful to replace the description of deprecated rules with just the word "Deprecated.".

Suggestion for the future: Simple Jekyll Search has a new maintainer and the new version seems to have some useful features (e.g. ignores word order, unless quotes are used) https://github.com/neilboyd/Simple-Jekyll-Search .

@adangel adangel force-pushed the doc/search-improvements branch from 89f8936 to 4c3019d Compare September 19, 2025 15:25
@adangel
Copy link
Member Author

adangel commented Sep 19, 2025

The new layout is nice!

Thanks!

Two (Chrome/Windows specific?) issues: when search is not active, there is an empty search box: When it is active, there are both vertical and horizontal scrollbars, even if they are not needed. Would it make sense to have just overflow-y: auto to fix both of these isues?

Yes, I thought/wanted to use "auto". I'm using Firefox, which seems to be different in this regards doesn't force scrollbars. Anyway, using overflow-y: auto now...

For renamed rules this gives the same description for both the new and the deprecated one -- it might be useful to replace the description of deprecated rules with just the word "Deprecated.".

Good idea, I've added this. We might need to experiment a little bit with the presentation, but it's better now.

Suggestion for the future: Simple Jekyll Search has a new maintainer and the new version seems to have some useful features (e.g. ignores word order, unless quotes are used) https://github.com/neilboyd/Simple-Jekyll-Search .

Thanks for the hint - yes. At some point, we should update...

Copy link
Contributor

@zbynek zbynek left a comment

Choose a reason for hiding this comment

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

Scrollbar issues are fixed now.

- split rule names
- disable fuzzy search
- correctly escape search index
- remove unused news.html and news_archive.html
- display title and summary
- navigation with arrow keys up/down
- keyboard shortcut "s" for search
- display 20 search results with scrolling
- close search results when clicking somewhere
- extracts rule descriptions into frontmatter
- use rule descriptions as summary for search result
- remove exclude configuration from search
  as it is not excluding data from search.json by key,
  but by regexing the content...
- remove escape_regex again
Move search index into an own js file, that is loaded via
<script> and not fetched. This allows to open the documentation
locally in a browser and still use the search functionality.
Otherwise, you'd need to run a local webserver.
@adangel adangel force-pushed the doc/search-improvements branch from 4c221c3 to f111bb2 Compare October 24, 2025 12:19
@adangel adangel merged commit aa3901b into pmd:main Oct 24, 2025
1 check passed
@adangel adangel deleted the doc/search-improvements branch October 24, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:documentation Affects the documentation [doc]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants