Skip to content

web: add per-type "view all" search results page#23

Merged
dotwaffle merged 2 commits into
mainfrom
search-view-all-results
Jun 8, 2026
Merged

web: add per-type "view all" search results page#23
dotwaffle merged 2 commits into
mainfrom
search-view-all-results

Conversation

@dotwaffle

Copy link
Copy Markdown
Owner

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.

  • Entry point: any grouped search type that overflows the 10-result cap gets a "View all N →" footer link (exact count) into /ui/search?q=<term>&type=<slug>.
  • Per-type page: header with the exact total, the full result set paginated with an htmx "Load more" button (50/page). The button targets itself and swaps with the next rows + button via hx-swap="outerHTML", so rows accumulate in one divided container.
  • Bounded: each request loads at most one page (limit+1 to 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.
  • Deterministic ordering (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.
  • Shared SearchRow templ component used by both surfaces so they can't drift.
  • Service layer: new SearchType + per-type list/count helpers behind a shared opsFor dispatch, reused by both Search and SearchType. 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 (SearchType pagination/ordering/ASN/unknown-type/short-query/clamping; Search exact-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, and golangci-lint run all pass.

🤖 Generated with Claude Code

dotwaffle and others added 2 commits June 8, 2026 12:01
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>
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

Code Metrics Report

Coverage Test Execution Time
80.9% 2m27s

Code coverage of files in pull request scope (88.5%)

Files Coverage
internal/web/handler.go 84.5%
internal/web/search.go 92.6%
internal/web/templates/searchtypes.go 83.3%

Reported by octocov

@dotwaffle dotwaffle merged commit 9bd1af9 into main Jun 8, 2026
2 checks passed
@dotwaffle dotwaffle deleted the search-view-all-results branch June 8, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant