all repos — searchix @ 12a29a55fe895a964d8d317857ee7fb87d4071f1

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

fix: always re-index if storage is (re-)created

Alan Pearce
commit

12a29a55fe895a964d8d317857ee7fb87d4071f1

parent

15a5b3210a073c83dbd1ace8969df83c53dac755

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

changed files
M cmd/searchix-web/ingest.gocmd/searchix-web/ingest.go
@@ -41,7 +41,7 @@ return fault.Wrap(err, fmsg.With("Failed to create store"))
} defer store.Close() - _, write, exists, err := index.OpenOrCreate( + _, write, err := index.OpenOrCreate( &index.Options{ Config: cfg, Force: opts.Reindex,
@@ -74,7 +74,8 @@ if err != nil {
return fault.Wrap(err, fmsg.With("Failed to create importer")) } - if !exists || opts.Replace || opts.Fetch { + updateStore := store.IsNew() || opts.Replace || opts.Fetch + if updateStore { importer.MarkImportStarted() err = imp.Fetch(ctx, true, opts.Fetch && !opts.Replace, nil)
@@ -90,7 +91,7 @@ return fault.Wrap(err, fmsg.With("Failed to save index metadata"))
} } - if !exists || opts.Reindex { + if !write.Exists() || updateStore { err = imp.Index(ctx) if err != nil { return fault.Wrap(err, fmsg.With("Failed to index data"))