all repos — searchix @ 520dcca2755dbbab13ceebdc53d03beec8b94533

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

feat: store data separate from search index

Alan Pearce
commit

520dcca2755dbbab13ceebdc53d03beec8b94533

parent

d25925f0d7c7e0951e739473795309514f5b558a

1 file changed, 4 insertions(+), 6 deletions(-)

changed files
M internal/server/mux.gointernal/server/mux.go
@@ -70,6 +70,7 @@ if options.ReadIndex == nil {
return nil, fault.New("read index is nil") } index := options.ReadIndex + store := options.Store sortSources(cfg.Importer.Sources) assets, err := frontend.New() if err != nil {
@@ -230,10 +231,7 @@ return
} importerSingular := importerType.Singular() - ctx, cancel := context.WithTimeout(r.Context(), searchTimeout) - doc, err := index.GetDocument(ctx, source, r.PathValue("id")) - cancel() - + doc, err := store.GetDocument(source, r.PathValue("id")) if err != nil { errorHandler( w,
@@ -260,9 +258,9 @@ }
var baseErr error if r.Header.Get("Fetch") == "true" { w.Header().Add("Content-Type", "text/html; charset=utf-8") - baseErr = components.Detail(*doc).Render(w) + baseErr = components.Detail(doc).Render(w) } else { - baseErr = components.DetailPage(tdata, *doc).Render(w) + baseErr = components.DetailPage(tdata, doc).Render(w) } if baseErr != nil { log.Error("template error", "template", importerSingular, "error", baseErr)