fix: always re-index if storage is (re-)created
1 file changed, 4 insertions(+), 2 deletions(-)
changed files
M cmd/searchix-web/serve.go → cmd/searchix-web/serve.go
@@ -47,7 +47,7 @@ return fault.Wrap(err, fmsg.With("Failed to create store")) } defer store.Close() - read, write, exists, err := index.OpenOrCreate( + read, write, err := index.OpenOrCreate( &index.Options{ Config: cfg, LowMemory: cfg.Importer.LowMemory,@@ -87,12 +87,14 @@ if err != nil { return fault.Wrap(err, fmsg.With("Failed to create importer")) } - if !exists { + if store.IsNew() { err = imp.Fetch(ctx, true, false, nil) if err != nil { return fault.Wrap(err, fmsg.With("Failed to start importer")) } + } + if store.IsNew() || !write.Exists() { err = imp.Index(ctx) if err != nil { return fault.Wrap(err, fmsg.With("Failed to index data"))