From 76f18d677b9b0bb70f701824e715f2ed10aeb8a0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2024 14:43:01 +0200 Subject: feat: version search index mapping schema and warn if outdated --- internal/search/search.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/search/search.go') diff --git a/internal/search/search.go b/internal/search/search.go index 357698c..829fefe 100644 --- a/internal/search/search.go +++ b/internal/search/search.go @@ -26,18 +26,26 @@ type Result struct { type ReadIndex struct { index bleve.Index + meta *IndexMeta } func Open(dataRoot string) (*ReadIndex, error) { indexPath := path.Join(dataRoot, indexBaseName) + metaPath := path.Join(dataRoot, metaBaseName) idx, err := bleve.Open(indexPath) if err != nil { return nil, errors.WithMessagef(err, "unable to open index at path %s", indexPath) } + meta, err := openMeta(metaPath) + if err != nil { + return nil, errors.WithMessagef(err, "unable to open metadata at path %s", metaPath) + } + return &ReadIndex{ idx, + meta, }, nil } -- cgit 1.4.1