filter.GetTheoreticalLimit() to encompass the actual limit specified in the filter.

This commit is contained in:
fiatjaf
2025-12-19 06:52:46 -03:00
parent 14dcc01f8f
commit daee8575d9
7 changed files with 23 additions and 20 deletions

View File

@@ -11,11 +11,10 @@ import (
func (b *BleveBackend) QueryEvents(filter nostr.Filter, maxLimit int) iter.Seq[nostr.Event] {
return func(yield func(nostr.Event) bool) {
limit := maxLimit
if filter.LimitZero {
if tlimit := filter.GetTheoreticalLimit(); tlimit == 0 {
return
} else if filter.Limit > 0 && filter.Limit < limit {
limit = filter.Limit
} else if tlimit < maxLimit {
maxLimit = tlimit
}
if len(filter.Search) < 2 {
@@ -72,7 +71,7 @@ func (b *BleveBackend) QueryEvents(filter nostr.Filter, maxLimit int) iter.Seq[n
}
req := bleve.NewSearchRequest(q)
req.Size = limit
req.Size = maxLimit
req.From = 0
result, err := b.index.Search(req)