bleve: open timeout option.
This commit is contained in:
+12
-5
@@ -84,9 +84,11 @@ var SupportedLanguages = []lingua.Language{
|
|||||||
|
|
||||||
type BleveBackend struct {
|
type BleveBackend struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
Path string
|
Path string
|
||||||
RawEventStore eventstore.Store
|
RawEventStore eventstore.Store
|
||||||
ReadOnly bool
|
ReadOnly bool
|
||||||
|
OpenTimeout time.Duration
|
||||||
|
|
||||||
IndexableKinds []nostr.Kind
|
IndexableKinds []nostr.Kind
|
||||||
|
|
||||||
Languages []lingua.Language
|
Languages []lingua.Language
|
||||||
@@ -131,9 +133,14 @@ func (b *BleveBackend) Init() error {
|
|||||||
}
|
}
|
||||||
b.Languages = validLanguages
|
b.Languages = validLanguages
|
||||||
|
|
||||||
index, err := bleve.OpenUsing(b.Path, map[string]any{
|
opts := map[string]any{
|
||||||
"read_only": b.ReadOnly,
|
"read_only": b.ReadOnly,
|
||||||
})
|
}
|
||||||
|
if b.OpenTimeout != 0 {
|
||||||
|
opts["bolt_timeout"] = b.OpenTimeout.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
index, err := bleve.OpenUsing(b.Path, opts)
|
||||||
if err == bleve.ErrorIndexPathDoesNotExist {
|
if err == bleve.ErrorIndexPathDoesNotExist {
|
||||||
mapping := bleveMapping.NewIndexMapping()
|
mapping := bleveMapping.NewIndexMapping()
|
||||||
mapping.DefaultMapping.Dynamic = false
|
mapping.DefaultMapping.Dynamic = false
|
||||||
|
|||||||
Reference in New Issue
Block a user