all repos — searchix @ 1aa991ae1f1a426424549c92060b204114c8b3c2

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

refactor: deduce index path automatically from config.DataPath

Alan Pearce
commit

1aa991ae1f1a426424549c92060b204114c8b3c2

parent

48423548f4718886d32a87ddd65d5ee2620fd8c8

1 file changed, 4 insertions(+), 1 deletion(-)

changed files
M internal/search/search.gointernal/search/search.go
@@ -4,6 +4,7 @@ import (
"bytes" "context" "encoding/gob" + "path" "searchix/internal/options" "github.com/blevesearch/bleve/v2"
@@ -27,7 +28,9 @@ type ReadIndex struct {
index bleve.Index } -func Open(indexPath string) (*ReadIndex, error) { +func Open(dataRoot string) (*ReadIndex, error) { + indexPath := path.Join(dataRoot, indexBaseName) + idx, err := bleve.Open(indexPath) if err != nil { return nil, errors.WithMessagef(err, "unable to open index at path %s", indexPath)