Problem/Motivation

When a search matches many entities of more than one type (e.g. hundreds of nodes and content blocks), the results page is one long list with only an h3 between the entity types. It's hard to see where one type ends and the next begins, or how many matches each type has, without scrolling through everything.

Proposed resolution

Render each entity type's results in a details element:
- The summary shows the type's label with its counts, e.g. "Content block (15 entities, 42 matches)".
- Groups are open by default for small result sets and closed for large ones, above a threshold such as 20 entities, so a large search shows a compact overview first.
- The list inside each group is unchanged.

This applies to both search results and the "Content that was changed" output after a replace, since they share the scanner_results template.

Remaining tasks

- Update scanner-results.html.twig and add preprocessing for the groups.
- Add test coverage for the grouping and the open/closed behaviour.
- Review.

User interface changes

Before

before

After

after

API changes

None.

Data model changes

None.

Issue fork scanner-3625710

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

john.oltman created an issue. See original summary.

john.oltman’s picture

Issue summary: View changes

john.oltman’s picture

Status: Active » Needs review
smustgrave’s picture

Related issues: +#3560456: Rework search UI

+1 to the idea I’ll take a look before the weekend. Tagging a potential release issue about improving the UI in general. Think this would be a step in that direction

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new224.84 KB
new56.28 KB

Added screenshots to the summary and took the liberty with 1 change and sorting the results. Was weird taxonomy being above content. Once pipeline finishes I'll merge

smustgrave’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

john.oltman’s picture

Sweet, thanks for the merge and the new release!