eventstore: replace bluge with bleve.

bluge seems to be abandoned and bleve should work better, who knows.
This commit is contained in:
fiatjaf
2025-11-22 09:16:40 -03:00
parent 8aa9c7e945
commit 98959e73e7
18 changed files with 266 additions and 329 deletions
+23
View File
@@ -0,0 +1,23 @@
package bleve
import (
"fmt"
"strconv"
"fiatjaf.com/nostr"
)
func (b *BleveBackend) SaveEvent(evt nostr.Event) error {
doc := map[string]interface{}{
contentField: evt.Content,
kindField: strconv.Itoa(int(evt.Kind)),
pubkeyField: evt.PubKey.Hex()[56:],
createdAtField: float64(evt.CreatedAt),
}
if err := b.index.Index(evt.ID.Hex(), doc); err != nil {
return fmt.Errorf("failed to index '%s' document: %w", evt.ID, err)
}
return nil
}