Skip to content

Commit 9047b5e

Browse files
Add search_params: {} to client.entities.search() (#23)
* Add search_params: {} to client.entities.search() * revert
1 parent 204ddaa commit 9047b5e

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## [Unreleased]
22

3+
## [0.10.4] - 2024-11-14
4+
- `client.entities.search()` now accepts `search_params: {}`
5+
36
## [0.10.3] - 2024-10-01
47
- Milvus::Client constructor accepts customer logger: to be passed in
58
- Added Alias management

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
milvus (0.10.3)
4+
milvus (0.10.4)
55
faraday (>= 2.0.1, < 3)
66

77
GEM

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,15 @@ client.entities.search(
187187
collection_name: "example_collection",
188188
anns_field: "vectors",
189189
data: [embedding],
190-
filter: "id in [450847466900987454]"
190+
# filter: "id in [450847466900987454]",
191+
search_params: {
192+
# Other accepted values: "COSINE" or "IP"
193+
# NOTE: metric_type must be the same as metric type used when index was created
194+
metric_type: "L2",
195+
params: {
196+
radius: 0.1, range_filter: 0.8
197+
}
198+
},
191199
)
192200
```
193201
```ruby

lib/milvus/entities.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,13 @@ def search(
123123
collection_name:,
124124
data:,
125125
anns_field:,
126+
filter: nil,
126127
limit: nil,
127-
output_fields: [],
128128
offset: nil,
129-
filter: nil
129+
grouping_field: nil,
130+
output_fields: [],
131+
search_params: {},
132+
partition_names: []
130133
)
131134
response = client.connection.post("#{PATH}/search") do |req|
132135
params = {
@@ -138,6 +141,10 @@ def search(
138141
params[:outputFields] = output_fields if output_fields.any?
139142
params[:offset] = offset if offset
140143
params[:filter] = filter if filter
144+
params[:searchParams] = search_params if search_params.any?
145+
params[:partitionNames] = partition_names if partition_names.any?
146+
params[:groupingField] = groupingField if grouping_field
147+
141148
req.body = params
142149
end
143150
response.body.empty? ? true : response.body

lib/milvus/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Milvus
4-
VERSION = "0.10.3"
4+
VERSION = "0.10.4"
55
end

0 commit comments

Comments
 (0)