diff --git a/client/column/json.go b/client/column/json.go index a1c147089748f..0471b05548344 100644 --- a/client/column/json.go +++ b/client/column/json.go @@ -134,7 +134,7 @@ func (c *ColumnJSONBytes) AppendValue(i interface{}) error { } v = bs default: - return fmt.Errorf("expect json compatible type([]byte, struct[}, map], got %T)", i) + return fmt.Errorf("expect json compatible type([]byte, struct, map), got %T", i) } } c.values = append(c.values, v) diff --git a/client/read_options.go b/client/read_options.go index bd04c62953eb6..152061b1a0526 100644 --- a/client/read_options.go +++ b/client/read_options.go @@ -31,6 +31,7 @@ const ( spAnnsField = `anns_field` spTopK = `topk` spOffset = `offset` + spLimit = `limit` spParams = `params` spMetricsType = `metric_type` spRoundDecimal = `round_decimal` @@ -197,15 +198,12 @@ type QueryOption interface { } type queryOption struct { - collectionName string - partitionNames []string - - limit int - offset int + collectionName string + partitionNames []string + queryParams map[string]string outputFields []string consistencyLevel entity.ConsistencyLevel useDefaultConsistencyLevel bool - ignoreGrowing bool expr string } @@ -216,6 +214,7 @@ func (opt *queryOption) Request() *milvuspb.QueryRequest { OutputFields: opt.outputFields, Expr: opt.expr, + QueryParams: entity.MapKvPairs(opt.queryParams), ConsistencyLevel: opt.consistencyLevel.CommonConsistencyLevel(), } } @@ -226,7 +225,18 @@ func (opt *queryOption) WithFilter(expr string) *queryOption { } func (opt *queryOption) WithOffset(offset int) *queryOption { - opt.offset = offset + if opt.queryParams == nil { + opt.queryParams = make(map[string]string) + } + opt.queryParams[spOffset] = strconv.Itoa(offset) + return opt +} + +func (opt *queryOption) WithLimit(limit int) *queryOption { + if opt.queryParams == nil { + opt.queryParams = make(map[string]string) + } + opt.queryParams[spLimit] = strconv.Itoa(limit) return opt }