all repos — searchix @ d6d0bf3856234f06ca5707df6c760904255bef08

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

feat: remove entities not present in current import

Alan Pearce
commit

d6d0bf3856234f06ca5707df6c760904255bef08

parent

f896b6861faae07485b8f7bee2e9b607527882c1

1 file changed, 16 insertions(+), 0 deletions(-)

changed files
M cmd/searchix-web/ingest.gocmd/searchix-web/ingest.go
@@ -75,16 +75,32 @@ return fault.Wrap(err, fmsg.With("Failed to create importer"))
} if !exists || opts.Replace || opts.Fetch { + importer.MarkImportStarted() + err = imp.Fetch(ctx, true, opts.Fetch && !opts.Replace, nil) if err != nil { return fault.Wrap(err, fmsg.With("Failed to start importer")) } + + importer.MarkImportFinished() + importer.MarkLastRun(write.Meta) + err = write.SaveMeta() + if err != nil { + return fault.Wrap(err, fmsg.With("Failed to save index metadata")) + } } if !exists || opts.Reindex { err = imp.Index(ctx) if err != nil { return fault.Wrap(err, fmsg.With("Failed to index data")) + } + } + + if opts.Replace || opts.Reindex { + err = imp.Prune(ctx) + if err != nil { + return fault.Wrap(err, fmsg.With("Failed to prune index")) } }