Skip to content

autocomplete 2/4: add in-memory index and fzf search - #261

Open
icio wants to merge 6 commits into
icio/bulk-importfrom
icio/search-fuzzy
Open

icio wants to merge 6 commits into
icio/bulk-importfrom
icio/search-fuzzy

Conversation

@icio

@icio icio commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot of fuzzy search (navbar search is in the following PR #262)

Screenshot 2026-10-07 at 11 16 37

Stack created with GitHub Stacks CLI • Give Feedback 💬

icio added 3 commits October 9, 2026 10:35
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>
@icio
icio force-pushed the icio/search-fuzzy branch from 39a1b4a to 682fa4d Compare October 9, 2026 09:37
icio added 3 commits October 9, 2026 11:37
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>
@icio
icio force-pushed the icio/search-fuzzy branch from 682fa4d to 73dc00a Compare October 9, 2026 10:38
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