diff --git a/search/query.go b/search/query.go index 9bbb384bd..45ae6434c 100644 --- a/search/query.go +++ b/search/query.go @@ -7,11 +7,13 @@ import ( "fmt" "io/ioutil" "log/slog" + "time" "github.com/bluesky-social/indigo/atproto/identity" - "go.opentelemetry.io/otel/attribute" + "github.com/bluesky-social/indigo/atproto/syntax" es "github.com/opensearch-project/opensearch-go/v2" + "go.opentelemetry.io/otel/attribute" ) type EsSearchHit struct { @@ -73,6 +75,15 @@ func DoSearchPosts(ctx context.Context, dir identity.Directory, escli *es.Client "analyze_wildcard": false, }, } + // filter out future posts (TODO: temporary hack) + today := syntax.DatetimeNow().Time().Format(time.DateOnly) + filters = append(filters, map[string]interface{}{ + "range": map[string]interface{}{ + "created_at": map[string]interface{}{ + "lte": today, + }, + }, + }) query := map[string]interface{}{ "query": map[string]interface{}{ "bool": map[string]interface{}{