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, 6 insertions(+), 3 deletions(-)

changed files
M internal/importer/main.gointernal/importer/main.go
@@ -15,6 +15,7 @@ "alin.ovh/searchix/internal/file"
"alin.ovh/searchix/internal/index" "alin.ovh/searchix/internal/manpages" "alin.ovh/searchix/internal/programs" + "alin.ovh/searchix/internal/storage" "alin.ovh/x/log" "github.com/Southclaws/fault"
@@ -28,6 +29,7 @@ Logger *log.Logger
WriteIndex *index.WriteIndex Manpages *manpages.URLMap Root *file.Root + Storage *storage.Store } var Job struct {
@@ -43,10 +45,11 @@ func MarkIndexingStarted() {
Job.StartedAt = time.Now() } -func MarkIndexingFinished() { +func MarkIndexingFinished(meta *index.Meta) { Job.LastRun.StartedAt = Job.StartedAt Job.LastRun.FinishedAt = time.Now() Job.StartedAt = time.Time{} + meta.LastImport = Job.LastRun } func SetNextRun(nextRun time.Time) {
@@ -183,7 +186,7 @@ if err != nil {
return fault.Wrap(err, fmsg.Withf("failed to create processor")) } - hadWarnings, err := imp.process(ctx, processor) + hadWarnings, err := imp.process(ctx, processor, source) if err != nil { return fault.Wrap(err, fmsg.Withf("failed to process source")) }
@@ -246,7 +249,7 @@ imp.options.Logger.Error("import failed", "source", name, "error", err)
} } - MarkIndexingFinished() + MarkIndexingFinished(meta) err := imp.options.WriteIndex.SaveMeta() if err != nil {