web: add per-type "view all" search results page#23
Merged
Conversation
The web search box is a quick lookup capped at 10 results per entity type, with a "(10+)" badge that was a dead end: there was no way to see the rest of the matches without dropping to one of the API surfaces. Add a per-type results page at /ui/search?q=<term>&type=<slug> that shows the exact total and the full result set, paginated with an htmx "Load more" button that appends 50 rows at a time and replaces itself with the next button via hx-swap="outerHTML". Each request loads at most one page (limit+1 to detect more), so replica memory stays bounded. The grouped quick-search gains a "View all N" footer link into this page for any type that overflows the 10-result cap; the exact count is fetched only for those overflowing types, so the common small-result case pays no extra query. Result ordering is now deterministic (name, then id) for every type, so offset paging is stable and the quick-search top-10 matches page one of the view-all list. The single result row is extracted into a shared SearchRow templ component used by both surfaces so they cannot drift. The service layer gains SearchType (one paginated page for a single type) and per-type list/count helpers behind a shared opsFor dispatch, which both Search and SearchType use. Terminal and JSON clients reuse the existing grouped-search renderer via a one-element group, so the new page degrades without a bespoke terminal path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Capture the per-type "view all" search results page (Added) and the facility-detail related-entity name fix that shipped on main after v1.19.5 (Fixed) under a single 1.20.0 section. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Code Metrics Report
Code coverage of files in pull request scope (88.5%)
Reported by octocov |
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.
Summary
The web search box is a quick lookup capped at 10 results per type, with a
(10+)badge that was a dead end — no way to see the rest without dropping to an API surface. This adds a per-type "view all" page./ui/search?q=<term>&type=<slug>.hx-swap="outerHTML", so rows accumulate in one divided container.limit+1to detect more). The exact total is counted only for types that overflow the quick-search cap, so the common small-result case pays no extra query.SearchRowtempl component used by both surfaces so they can't drift.SearchType+ per-typelist/counthelpers behind a sharedopsFordispatch, reused by bothSearchandSearchType. Terminal/JSON clients reuse the existing grouped-search renderer via a one-element group — no bespoke terminal path.Design decisions (htmx "Load more", per-type pages, exact counts, page size 50, name-ascending sort,
?type=&offset=query params) were agreed up front.Changelog
Rolls v1.20.0, covering this feature (Added) and the facility-detail related-entity name fix already merged after v1.19.5 (Fixed).
Tests
New service tests (
SearchTypepagination/ordering/ASN/unknown-type/short-query/clamping;Searchexact-total-when-overflow) and handler tests (full page, load-more fragment, exhaustion, unknown-type 404, non-numeric offset, view-all link).go generate ./...clean (no drift),go build,go test -race ./...,go vet, andgolangci-lint runall pass.🤖 Generated with Claude Code