Skip to content

feat: on-page quicksearch and native browser address bar fuzzy-find - #259

Closed
icio wants to merge 11 commits into
mainfrom
icio/fzf
Closed

icio wants to merge 11 commits into
mainfrom
icio/fzf

Conversation

@icio

@icio icio commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

This change adds an in-memory index of links so that we can perform cmd+k style fuzzy matching. This appears in three places: /.search?q=..., the autocomplete at the top of the page, and in the browser's own address bar with updated opensearch definitions.

The new page header with persistent search bar:

Screenshot 2026-10-07 at 11 14 15

Empty autocomplete state, describing how to use it:

Screenshot 2026-10-07 at 11 15 39

Autocomplete results:

Screenshot 2026-10-07 at 11 16 30

Clicking "Full results"

Screenshot 2026-10-07 at 11 16 37

Searching by address too:

Screenshot 2026-10-07 at 11 18 20

Here's a video demo of the keyboard controls:

Screenshot.2026-10-07.at.11.19.58.mp4

And the same demo using the browser autocomplete in Chrome. In this recording I'm running with -dev-listen=:8080 instead of having golink join my tailnet as http://go/. I set the autocomplete to "@go" instead of "go" as otherwise Chrome tries to fill the address bar suggestions with history entries instead of results from golink.

Screenshot.2026-10-07.at.11.34.36.mp4

Next I think we might want to change http://go/unknown to also show search results for "unknown" in addition to the creation form.

@icio icio changed the title feat: native address bar fuzzy-find feat: on-page quicksearch and native browser address bar fuzzy-find Oct 6, 2026
@icio
icio force-pushed the icio/fzf branch 3 times, most recently from 7c7e63d to df285c4 Compare October 7, 2026 10:01
Comment thread package.json
"start:css": "tailwindcss --watch -o static/base.css",
"build:css": "tailwindcss -o static/base.css"
"start:css": "tailwindcss --watch -i static/base.src.css -o static/base.css",
"build:css": "tailwindcss -i static/base.src.css -o static/base.css"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Apparently we'd need to upgrade to Tailwind v4 to specify these extra CSS declarations in the config file.

@icio
icio force-pushed the icio/fzf branch 2 times, most recently from 7c1005b to e60cfc4 Compare October 7, 2026 10:55
icio added 11 commits October 7, 2026 10:57
Reduces import time of 1731 records to a new database
from 15.5s to 0.3s.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Rework the shared results template to show a proper heading, a result
count ("N results"), and friendly empty states, driven by a new
searchPageData struct used by both /.search and /.all. The /.search
backend is unchanged: it still only supports the "owner:<email>" query.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Introduce searchFilters, searchInput, and parseSearchInput, which parse
a raw query string into structured filters ("owner:<email>"), an
include-long "?" prefix, and a short/path/query split. serveSearch now
routes its owner handling through the parser. No behavior change: the
only query that resolves is still "owner:<email>".

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Introduce the SearchResult type and a runSearch helper that collect the
matching links (still only the "owner:<email>" path) and build results
carrying a click Target, a rendered long URL, and a detail-page link.
Add the contains/highlight template funcs (highlight receives no match
positions yet, so it renders plain text) and an annotateClicks helper.
serveSearch and serveAll now render []SearchResult. No behavior change.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Add an idx map to SQLiteDB, populated at startup via rebuildIndexLocked
and kept in sync by Save, SaveAll, and Delete under the existing mutex.
Stored Link values are copied so caller-side mutation can't leak in.
Nothing reads the index yet; it's the backing store for the upcoming
fuzzy search.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Add SearchShort, which fuzzy-matches the query against the in-memory
index's short names (and, with includeLong, long URLs too), applies the
owner filter, and returns ranked SearchMatch results with the matched
rune positions for highlighting. Adds the github.com/sahilm/fuzzy
dependency. Not yet wired to a handler.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Rewire runSearch onto the fuzzy SearchShort index and drop the
owner-only GetLinksByOwner path. /.search now fuzzy-matches short names
(and long URLs with a leading "?"), highlights matched runes with
<mark>, previews a path/query via expandLink, and truncates at 100 with
a notice. The results page gains a refine form, usage tips, and a
best-match-first count.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Content-negotiate /.search on the Accept header: application/json
returns a compact autocomplete payload (capped at 8 results, with a
limitHit flag and no-store caching) for the JS combobox, while browsers
keep getting the HTML page (capped at 100). JSON requests tolerate an
unresolved user instead of erroring.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Add a WAI-ARIA combobox form to the page header (a plain GET /.search
form that works without JS) and reference the not-yet-added search.js
that will enhance it. Move the stylesheet to a base.src.css source
compiled by tailwind (content now scans static/*.js) and regenerate
static/base.css with the new combobox and results-page styles.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Add static/search.js, which enhances the header form into a WAI-ARIA
combobox: it debounces keystrokes, fetches /.search as JSON, renders a
listbox popup with fuzzy-match highlighting and a "Full results" footer,
and supports full keyboard navigation (arrows, Home/End, Enter, Escape)
plus modifier clicks for new tab/window and the detail page.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Generate OpenSearch URLs from the request scheme/host, add a native
suggestions endpoint with destination URL hints, remove deprecated
moz:SearchForm metadata, and set the discovery link title to go.

Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
@icio
icio marked this pull request as ready for review October 7, 2026 10:58
@icio
icio requested a review from willnorris October 7, 2026 11:05
@icio

icio commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Split into #260, #261, #262, #263

@icio icio closed this Oct 8, 2026
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