a big bundle of conversions and other changes.
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
package bluge
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/blugelabs/bluge"
|
||||
"fiatjaf.com/nostr"
|
||||
"github.com/blugelabs/bluge"
|
||||
)
|
||||
|
||||
func (b *BlugeBackend) SaveEvent(ctx context.Context, evt *nostr.Event) error {
|
||||
func (b *BlugeBackend) SaveEvent(evt nostr.Event) error {
|
||||
id := eventIdentifier(evt.ID)
|
||||
doc := &bluge.Document{
|
||||
bluge.NewKeywordFieldBytes(id.Field(), id.Term()).Sortable().StoreValue(),
|
||||
}
|
||||
|
||||
doc.AddField(bluge.NewTextField(contentField, evt.Content))
|
||||
doc.AddField(bluge.NewTextField(kindField, strconv.Itoa(evt.Kind)))
|
||||
doc.AddField(bluge.NewTextField(pubkeyField, evt.PubKey[56:]))
|
||||
doc.AddField(bluge.NewTextField(kindField, strconv.Itoa(int(evt.Kind))))
|
||||
doc.AddField(bluge.NewTextField(pubkeyField, evt.PubKey.Hex()[56:]))
|
||||
doc.AddField(bluge.NewNumericField(createdAtField, float64(evt.CreatedAt)))
|
||||
|
||||
if err := b.writer.Update(doc.ID(), doc); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user