mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Refactor to use optional.Option for issue index search option (#29739)
Signed-off-by: 6543 <6543@obermui.de> (cherry picked from commit 7fd0a5b276aadcf88dcc012fcd364fe160a58810)
This commit is contained in:
parent
f98211f13a
commit
d9103449b3
12 changed files with 178 additions and 225 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue