From 6781684647ad7f131054a93e1d13105d865c0e83 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Jul 2024 20:52:52 +0200 Subject: feat: enable combined search --- internal/components/combined.templ | 38 +++++++++++++++++++++ internal/components/data.go | 3 +- internal/components/page.templ | 26 ++++++++++++-- internal/components/results.templ | 19 ++++++++--- internal/config/importer-type.go | 7 +++- internal/index/search.go | 69 +++++++++++++++++++------------------- internal/server/mux.go | 50 ++++++++++++++++++++++----- 7 files changed, 158 insertions(+), 54 deletions(-) create mode 100644 internal/components/combined.templ (limited to 'internal') diff --git a/internal/components/combined.templ b/internal/components/combined.templ new file mode 100644 index 0000000..eeacdb5 --- /dev/null +++ b/internal/components/combined.templ @@ -0,0 +1,38 @@ +package components + +import ( + "go.alanpearce.eu/searchix/internal/index" + "go.alanpearce.eu/searchix/internal/nix" +) + +templ Combined(result *index.Result) { +
Attribute | +Description | +
---|---|
+ @openCombinedDialogLink(nix.GetKey(hit.Data)) + | ++ switch hit.Data.(type) { + case nix.Option: + if o := convertMatch[nix.Option](hit.Data); o != nil { + @markdown(firstSentence(o.Description)) + } + case nix.Package: + if o := convertMatch[nix.Package](hit.Data); o != nil { + { firstSentence(o.Description) } + } + } + | +