all repos — searchix @ 0e24d9cde2f9a9e94315fa463d6503ddd64255c2

Search engine for NixOS, nix-darwin, home-manager and NUR users

refactor: reduce use of pointers in particular, Source can no longer be nil. Instantiate a Source with an Importer of All instead

Alan Pearce
commit

0e24d9cde2f9a9e94315fa463d6503ddd64255c2

parent

05838942b9468dd1efb6d295a206730fa82264c0

1 file changed, 5 insertions(+), 3 deletions(-)

changed files
M internal/server/global.gointernal/server/global.go
@@ -30,7 +30,7 @@
errorHandler func(w http.ResponseWriter, r *http.Request, message string, statusCode int) } -func (g *GlobalHandler) NewSourceHandler(source *config.Source) *SourceHandler { +func (g *GlobalHandler) NewSourceHandler(source config.Source) *SourceHandler { h := &SourceHandler{ global: g, source: source,
@@ -44,7 +44,7 @@
return h } -func (g *GlobalHandler) Search(source *config.Source, w http.ResponseWriter, r *http.Request) { +func (g *GlobalHandler) Search(source config.Source, w http.ResponseWriter, r *http.Request) { facets := r.URL.Query() facets.Del("query") facets.Del("page")
@@ -148,7 +148,9 @@ }
} func (g *GlobalHandler) CombinedSearch(w http.ResponseWriter, r *http.Request) { - g.Search(nil, w, r) + g.Search(config.Source{ + Importer: config.All, + }, w, r) } func (g *GlobalHandler) RootOpenSearch(w http.ResponseWriter, _ *http.Request) {