feat: store data separate from search index
1 file changed, 14 insertions(+), 0 deletions(-)
changed files
M cmd/searchix-web/main.go → cmd/searchix-web/main.go
@@ -20,6 +20,7 @@ "alin.ovh/searchix/internal/importer" "alin.ovh/searchix/internal/index" "alin.ovh/searchix/internal/manpages" "alin.ovh/searchix/internal/server" + "alin.ovh/searchix/internal/storage" "alin.ovh/searchix/web" "alin.ovh/x/log" )@@ -108,13 +109,24 @@ logger.Fatal("Failed to open data root", "error", err) } defer root.Close() + store, err := storage.New(&storage.Options{ + Root: root, + Logger: logger.Named("store"), + }) + if err != nil { + logger.Fatal("Failed to create store", "error", err) + } + defer store.Close() + read, write, exists, err := index.OpenOrCreate( &index.Options{ + Config: cfg, Force: *replace, LowMemory: cfg.Importer.LowMemory, BatchSize: cfg.Importer.BatchSize, Logger: logger.Named("index"), Root: root, + Store: store, }, ) if err != nil {@@ -129,12 +141,14 @@ s, err := web.New(cfg, logger, &server.Options{ ReadIndex: read, ManpagesURLMap: mdb, + Store: store, }) if err != nil { logger.Fatal("Failed to initialise searchix-web", "error", err) } imp, err := importer.New(cfg, &importer.Options{ + Storage: store, WriteIndex: write, LowMemory: cfg.Importer.LowMemory, Logger: logger.Named("importer"),