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 Mar 8, 2024
1 parent 38c8c03 commit efc644a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions 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,7 +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 efc644a

Please sign in to comment.