diff options
author | 6543 <6543@obermui.de> | 2024-03-13 09:25:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 08:25:53 +0000 |
commit | 7fd0a5b276aadcf88dcc012fcd364fe160a58810 (patch) | |
tree | 35701a5dc87f3e69ae5f25a681ac0702887b43af /modules/indexer/internal | |
parent | 67e9f0d49828f62a942ac6db04153207f88e82ee (diff) | |
download | gitea-7fd0a5b276aadcf88dcc012fcd364fe160a58810.tar.gz gitea-7fd0a5b276aadcf88dcc012fcd364fe160a58810.zip |
Refactor to use optional.Option for issue index search option (#29739)
Signed-off-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules/indexer/internal')
-rw-r--r-- | modules/indexer/internal/bleve/query.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/indexer/internal/bleve/query.go b/modules/indexer/internal/bleve/query.go index 2a427c4020..b96875343e 100644 --- a/modules/indexer/internal/bleve/query.go +++ b/modules/indexer/internal/bleve/query.go @@ -4,6 +4,8 @@ package bleve import ( + "code.gitea.io/gitea/modules/optional" + "github.com/blevesearch/bleve/v2" "github.com/blevesearch/bleve/v2/search/query" ) @@ -39,18 +41,18 @@ func BoolFieldQuery(value bool, field string) *query.BoolFieldQuery { return q } -func NumericRangeInclusiveQuery(min, max *int64, field string) *query.NumericRangeQuery { +func NumericRangeInclusiveQuery(min, max optional.Option[int64], field string) *query.NumericRangeQuery { var minF, maxF *float64 var minI, maxI *bool - if min != nil { + if min.Has() { minF = new(float64) - *minF = float64(*min) + *minF = float64(min.Value()) minI = new(bool) *minI = true } - if max != nil { + if max.Has() { maxF = new(float64) - *maxF = float64(*max) + *maxF = float64(max.Value()) maxI = new(bool) *maxI = true } |