Rebuild search index in admin options (#647)

Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
هذا الالتزام موجود في:
Thomas Miceli
2026-03-09 06:30:28 +07:00
ملتزم من قبل GitHub
الأصل a697b0f273
التزام f8b3bbce6a
16 ملفات معدلة مع 71 إضافات و25 حذوفات

عرض الملف

@@ -2,6 +2,8 @@ package index
import (
"errors"
"fmt"
"os"
"strconv"
"github.com/blevesearch/bleve/v2"
@@ -82,6 +84,15 @@ func (i *BleveIndexer) open() (bleve.Index, error) {
return bleve.New(i.path, mapping)
}
func (i *BleveIndexer) Reset() error {
i.Close()
if err := os.RemoveAll(i.path); err != nil {
return fmt.Errorf("failed to remove Bleve index directory: %w", err)
}
log.Info().Msg("Bleve index directory removed, re-creating index")
return i.Init()
}
func (i *BleveIndexer) Close() {
if i == nil || i.index == nil {
return