Skip to content

Commit

Permalink
palomar: filter out 'future' content from post queries
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Dec 15, 2023
1 parent a62f354 commit acd8a85
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion search/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{}{
Expand Down

0 comments on commit acd8a85

Please sign in to comment.