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(+), 2 deletions(-)

changed files
M cmd/searchix-web/serve.gocmd/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"))