mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-04 06:40:29 +08:00
refactor: use the built-in max/min to simplify the code (#17059)
### Summary In Go 1.21, the standard library includes built-in [max/min](https://pkg.go.dev/builtin@go1.21.0#max) function, which can greatly simplify the code. Signed-off-by: futurehua <futurehua@outlook.com>
This commit is contained in:
@@ -703,10 +703,7 @@ func (e *infinityEngine) Search(ctx context.Context, req *types.SearchRequest) (
|
||||
pageSize = 30
|
||||
}
|
||||
|
||||
offset := req.Offset
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
offset := max(req.Offset, 0)
|
||||
|
||||
db, release, err := e.client.checkoutDatabase(ctx, "chunk.go")
|
||||
if err != nil {
|
||||
|
||||
@@ -583,10 +583,7 @@ func (e *infinityEngine) SearchMetadata(ctx context.Context, req *types.SearchMe
|
||||
if pageSize <= 0 {
|
||||
pageSize = 30
|
||||
}
|
||||
offset := req.Offset
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
offset := max(req.Offset, 0)
|
||||
|
||||
// Build filter from req.Filter
|
||||
var filterStr string
|
||||
|
||||
Reference in New Issue
Block a user