bring in updates from relayer.

This commit is contained in:
fiatjaf
2023-10-31 15:49:01 -03:00
parent 473d817cc6
commit e95c3cb033
8 changed files with 48 additions and 34 deletions

View File

@@ -11,9 +11,12 @@ import (
"github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v8/esutil"
"github.com/fiatjaf/eventstore"
"github.com/nbd-wtf/go-nostr"
)
var _ eventstore.Storage = (*ElasticsearchStorage)(nil)
type IndexedEvent struct {
Event nostr.Event `json:"event"`
ContentSearch string `json:"content_search"`

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"log"
@@ -73,12 +74,12 @@ func buildDsl(filter nostr.Filter) ([]byte, error) {
// since
if filter.Since != nil {
dsl.Must(esquery.Range("event.created_at").Gt(filter.Since))
dsl.Must(esquery.Range("event.created_at").Gte(filter.Since))
}
// until
if filter.Until != nil {
dsl.Must(esquery.Range("event.created_at").Lt(filter.Until))
dsl.Must(esquery.Range("event.created_at").Lte(filter.Until))
}
// search