fix: always re-index if storage is (re-)created
1 file changed, 4 insertions(+), 3 deletions(-)
changed files
M cmd/searchix-web/ingest.go → cmd/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"))