feat(frontend): tab Options page sources, opt into ES request_cache#1246
Open
KiaraGrouwstra wants to merge 1 commit intomainfrom
Open
feat(frontend): tab Options page sources, opt into ES request_cache#1246KiaraGrouwstra wants to merge 1 commit intomainfrom
KiaraGrouwstra wants to merge 1 commit intomainfrom
Conversation
Replaces the multi-checkbox `includedOptionSources : Set String` with
a single `activeOptionSource : OptionSource`. The Options page now
shows one source at a time per tab.
Each tab issues a single ES query with a fixed `term: { type: <one> }`
filter, so the request body is byte-stable across users on identical
input. With the new `?request_cache=true` opt-in (added on the new
`Search.makeRequestTask` Task-based path used by Options), repeated
queries become near-free shard cache hits rather than per-user noise.
Compared to the previous "single query with `terms` array" shape:
- Up to 7 distinct cache keys per popular query (one per checkbox
combo) collapses to 1 per tab.
- Per-result source badges become redundant (one tab = one docType)
and are dropped along with their CSS.
Each tab carries a hit-count badge (GitHub style). The active count
is mirrored from `QueryResponse` into a shared `sourceCounts` dict;
inactive counts arrive via `size: 0` count queries fired alongside
the main one — the workload ES's `request_cache` was designed for, so
once a popular query has been seen on any source the count queries
cost almost nothing. Counts render as `1234`, `1.2k`, or `10k+` (ES
caps `total.value` at 10000 unless we ask otherwise, so don't pretend
the larger numbers are exact). Reading counts uniformly from one
place means badges survive a tab switch unchanged — the previous
tab's count stays visible until a fresh count for the new tab
arrives.
Stale-while-revalidating: while a fresh query is in flight,
`viewResult` renders the last successful result (kept around in
`previousResult`) overlaid with a small CSS spinner instead of
flashing the full-page loader. Tab switches and pagination keep the
result list visible and the page no longer jumps.
The new URL shape is `?source=<id>` (omitted for the default `nixos`
tab).
Assisted-by: Claude:claude-opus-4-7[1m]
Contributor
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.
switch option categories from checkboxes to tabs to improve cacheability and decrease visual clutter.
Replaces the multi-checkbox
includedOptionSources : Set Stringwith a singleactiveOptionSource : OptionSource. The Options page now shows one source at a time per tab.Each tab issues a single ES query with a fixed
term: { type: <one> }filter, so the request body is byte-stable across users on identical input. With the new?request_cache=trueopt-in (added on the newSearch.makeRequestTaskTask-based path used by Options), repeated queries become near-free shard cache hits rather than per-user noise.Compared to the previous "single query with
termsarray" shape:Each tab carries a hit-count badge. The active tab's count comes from the in-flight query result; inactive tabs are populated by a
size: 0count query per tab fired alongside the main request.size: 0is the workload ES'srequest_cachewas designed for, so once a popular query has been seen on any source the count queries cost almost nothing. Counts render as1234,1.2k, or10k+(ES capstotal.valueat 10000 unless we ask otherwise, so don't pretend the larger numbers are exact). Counts clear on every fresh load so stale badges don't linger; inactive errors are swallowed silently since the badge is a hint, not a result.The new URL shape is
?source=<id>(omitted for the defaultnixostab).Tackles #1237 (comment) concern regarding load on Elastic Search, and #1210's suggestion to return to a pre-badge uncluttered UI.
Disclaimer: I used a coding agent in the creation of this patch.