Skip to content

Commit c8fdd3f

Browse files
committed
refactor: Remove Bleve search engine and related components
1 parent abe5621 commit c8fdd3f

File tree

6 files changed

+0
-628
lines changed

6 files changed

+0
-628
lines changed

.vscode/launch.json

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@
4141
"./certs",
4242
]
4343
},
44-
{
45-
"name": "dhee server (bleve)",
46-
"type": "go",
47-
"request": "launch",
48-
"mode": "auto",
49-
"program": "${workspaceFolder}/cmd/dhee/main.go",
50-
"cwd": "${workspaceFolder}",
51-
"internalConsoleOptions": "openOnSessionStart",
52-
"preLaunchTask": "go_generate",
53-
"buildFlags": [
54-
"-tags=json1,fts5"
55-
],
56-
"args": [
57-
"server",
58-
"--data-dir",
59-
"./data",
60-
"--store",
61-
"bleve"
62-
]
63-
},
6444
{
6545
"name": "dhee index",
6646
"type": "go",
@@ -81,26 +61,6 @@
8161
"sqlite"
8262
]
8363
},
84-
{
85-
"name": "dhee index (bleve)",
86-
"type": "go",
87-
"request": "launch",
88-
"mode": "auto",
89-
"preLaunchTask": "remove_db",
90-
"buildFlags": [
91-
"-tags=json1,fts5"
92-
],
93-
"program": "${workspaceFolder}/cmd/dhee/main.go",
94-
"cwd": "${workspaceFolder}",
95-
"internalConsoleOptions": "openOnSessionStart",
96-
"args": [
97-
"index",
98-
"--data-dir",
99-
"./data",
100-
"--store",
101-
"bleve"
102-
]
103-
},
10464
{
10565
"name": "dhee stats",
10666
"type": "go",

app/dictionary/bleve_dictionary_store.go

Lines changed: 0 additions & 215 deletions
This file was deleted.

app/docstore/bleve.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/docstore/initial_load.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import (
1010
"log/slog"
1111
"os"
1212
"path"
13-
"path/filepath"
1413
"strings"
1514

16-
"github.com/blevesearch/bleve/v2"
1715
"github.com/blevesearch/bleve/v2/analysis"
1816
"github.com/blevesearch/bleve/v2/analysis/char/asciifolding"
1917
"github.com/blevesearch/bleve/v2/mapping"
@@ -362,41 +360,6 @@ func LoadInitialData(dictStore dictionary.DictStore, excerptStore excerpts.Excer
362360

363361
func InitDB(store, dataDir string, config *config.DheeConfig) (io.Closer, error) {
364362
switch store {
365-
case "bleve":
366-
dbPath := filepath.Join(dataDir, "docstore.bleve")
367-
368-
_, err := os.Stat(dbPath)
369-
370-
if errors.Is(err, os.ErrNotExist) {
371-
slog.Info("Creating new bleve index", "path", dbPath)
372-
mapping := GetBleveIndexMappings()
373-
index, err := bleve.New(dbPath, mapping)
374-
if err != nil {
375-
return nil, fmt.Errorf("failed to create new bleve index: %w", err)
376-
}
377-
378-
slog.Info("Loading initial data into the index...")
379-
dictStore := dictionary.NewBleveDictStore(index, config)
380-
excerptStore := excerpts.NewBleveExcerptStore(index, config)
381-
382-
if err := LoadInitialData(dictStore, excerptStore, dataDir, config); err != nil {
383-
// Cleanup created index on load failure
384-
os.RemoveAll(dbPath)
385-
return nil, fmt.Errorf("failed to load data: %w", err)
386-
}
387-
slog.Info("Initial data loaded successfully.")
388-
if err := index.Close(); err != nil {
389-
return nil, err
390-
}
391-
} else if err != nil {
392-
return nil, fmt.Errorf("failed to open bleve index: %w", err)
393-
}
394-
index, err := bleve.OpenUsing(dbPath, map[string]any{"read_only": true})
395-
if err != nil {
396-
return nil, err
397-
}
398-
slog.Info("Opened existing bleve index", "path", dbPath)
399-
return index, nil
400363
case "sqlite":
401364
dbPath := path.Join(dataDir, "dhee.db")
402365
_, err := os.Stat(dbPath)

0 commit comments

Comments
 (0)