diff options
author | Alan Pearce | 2024-05-09 18:47:37 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-09 19:28:13 +0200 |
commit | 0986e8699e87addccbef43c0ce30a466988fed15 (patch) | |
tree | fa40d9609b8764966c7c477fb91ef3c01113635d /internal/search/search.go | |
parent | 1db7c2a1630c3d80c3c696c8fabaa5476eb2184e (diff) | |
download | searchix-0986e8699e87addccbef43c0ce30a466988fed15.tar.lz searchix-0986e8699e87addccbef43c0ce30a466988fed15.tar.zst searchix-0986e8699e87addccbef43c0ce30a466988fed15.zip |
feat: enable index path to be configured
Diffstat (limited to 'internal/search/search.go')
-rw-r--r-- | internal/search/search.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/internal/search/search.go b/internal/search/search.go index 92afdfb..9766294 100644 --- a/internal/search/search.go +++ b/internal/search/search.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/gob" - "path" "searchix/internal/options" "github.com/blevesearch/bleve/v2" @@ -13,7 +12,6 @@ import ( ) const ResultsPerPage = 20 -const indexFilename = "index.bleve" type DocumentMatch struct { search.DocumentMatch @@ -29,9 +27,7 @@ type ReadIndex struct { index bleve.Index } -func Open(dir string) (*ReadIndex, error) { - indexPath := path.Join(dir, indexFilename) - +func Open(indexPath string) (*ReadIndex, error) { idx, err := bleve.Open(indexPath) if err != nil { return nil, errors.WithMessagef(err, "unable to open index at path %s", indexPath) |