Class: Qdrant::Points
Constant Summary collapse
- PATH =
"points"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#batch_recommend(collection_name:, searches:, consistency: nil) ⇒ Object
Look for the points which are closer to stored positive examples and at the same time further to negative examples.
-
#batch_search(collection_name:, searches:, consistency: nil) ⇒ Object
Retrieve by batch the closest points based on vector similarity and given filtering conditions.
-
#clear_payload(collection_name:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Remove all payload for specified points.
-
#clear_payload_keys(collection_name:, keys:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Delete specified key payload for points.
-
#count(collection_name:, filter: nil, exact: nil) ⇒ Object
Count points which matches given filtering condition.
-
#delete(collection_name:, points: nil, wait: nil, ordering: nil, filter: nil) ⇒ Object
Delete points.
-
#get(collection_name:, id:, consistency: nil) ⇒ Object
Retrieve full information of single point by id.
-
#get_all(collection_name:, ids:, consistency: nil, with_payload: nil, with_vector: nil) ⇒ Object
Retrieve full information of points by ids.
-
#list(collection_name:, ids: nil, with_payload: nil, with_vector: nil, consistency: nil) ⇒ Object
Lists all data objects in reverse order of creation.
-
#overwrite_payload(collection_name:, payload:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Replace full payload of points with new one.
-
#recommend(collection_name:, positive:, limit:, negative: nil, filter: nil, params: nil, offset: nil, with_payload: nil, with_vector: nil, score_threshold: nil, using: nil, lookup_from: nil, consistency: nil) ⇒ Object
Look for the points which are closer to stored positive examples and at the same time further to negative examples.
-
#scroll(collection_name:, limit:, filter: nil, offset: nil, with_payload: nil, with_vector: nil, consistency: nil) ⇒ Object
Scroll request - paginate over all points which matches given filtering condition.
-
#search(collection_name:, vector:, limit:, filter: nil, params: nil, offset: nil, with_payload: nil, with_vector: nil, score_threshold: nil, consistency: nil) ⇒ Object
Retrieve closest points based on vector similarity and given filtering conditions.
-
#set_payload(collection_name:, payload:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Set payload values for points.
-
#upsert(collection_name:, wait: nil, ordering: nil, batch: nil, points: nil) ⇒ Object
Perform insert + updates on points.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Qdrant::Base
Instance Method Details
#batch_recommend(collection_name:, searches:, consistency: nil) ⇒ Object
Look for the points which are closer to stored positive examples and at the same time further to negative examples.
283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/qdrant/points.rb', line 283 def batch_recommend( collection_name:, searches:, consistency: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/recommend/batch") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["searches"] = searches end response.body end |
#batch_search(collection_name:, searches:, consistency: nil) ⇒ Object
Retrieve by batch the closest points based on vector similarity and given filtering conditions
233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/qdrant/points.rb', line 233 def batch_search( collection_name:, searches:, consistency: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/search/batch") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["searches"] = searches end response.body end |
#clear_payload(collection_name:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Remove all payload for specified points
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/qdrant/points.rb', line 162 def clear_payload( collection_name:, wait: nil, ordering: nil, points: nil, filter: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/payload/clear") do |req| req.params["wait"] = wait unless wait.nil? req.params["ordering"] = ordering unless ordering.nil? req.body = {} req.body["points"] = points unless points.nil? req.body["filter"] = filter unless filter.nil? end response.body end |
#clear_payload_keys(collection_name:, keys:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Delete specified key payload for points
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/qdrant/points.rb', line 142 def clear_payload_keys( collection_name:, keys:, wait: nil, ordering: nil, points: nil, filter: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/payload/delete") do |req| req.params["wait"] = wait unless wait.nil? req.params["ordering"] = ordering unless ordering.nil? req.body = {} req.body["keys"] = keys req.body["points"] = points unless points.nil? req.body["filter"] = filter unless filter.nil? end response.body end |
#count(collection_name:, filter: nil, exact: nil) ⇒ Object
Count points which matches given filtering condition
298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/qdrant/points.rb', line 298 def count( collection_name:, filter: nil, exact: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/count") do |req| req.body = {} req.body["filter"] = filter unless filter.nil? req.body["exact"] = filter unless exact.nil? end response.body end |
#delete(collection_name:, points: nil, wait: nil, ordering: nil, filter: nil) ⇒ Object
Delete points
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/qdrant/points.rb', line 47 def delete( collection_name:, points: nil, wait: nil, ordering: nil, filter: nil ) raise ArgumentError, "Either points or filter should be provided" if points.nil? && filter.nil? response = client.connection.post("collections/#{collection_name}/#{PATH}/delete") do |req| req.params["wait"] = wait unless wait.nil? req.params["ordering"] = ordering unless ordering.nil? req.body = {} req.body["points"] = points unless points.nil? req.body["filter"] = filter unless filter.nil? end response.body end |
#get(collection_name:, id:, consistency: nil) ⇒ Object
Retrieve full information of single point by id
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/qdrant/points.rb', line 70 def get( collection_name:, id:, consistency: nil ) response = client.connection.get("collections/#{collection_name}/#{PATH}/#{id}") do |req| req.params["consistency"] = consistency unless consistency.nil? end response.body end |
#get_all(collection_name:, ids:, consistency: nil, with_payload: nil, with_vector: nil) ⇒ Object
Retrieve full information of points by ids
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/qdrant/points.rb', line 82 def get_all( collection_name:, ids:, consistency: nil, with_payload: nil, with_vector: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["ids"] = ids req.body["with_payload"] = with_payload unless with_payload.nil? req.body["with_vector"] = with_vector unless with_vector.nil? end response.body end |
#list(collection_name:, ids: nil, with_payload: nil, with_vector: nil, consistency: nil) ⇒ Object
Lists all data objects in reverse order of creation. The data will be returned as an array of objects.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/qdrant/points.rb', line 8 def list( collection_name:, ids: nil, with_payload: nil, with_vector: nil, consistency: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["ids"] = ids req.body["with_payload"] = with_payload unless with_payload.nil? req.body["with_vector"] = with_vector unless with_vector.nil? end response.body end |
#overwrite_payload(collection_name:, payload:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Replace full payload of points with new one
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/qdrant/points.rb', line 122 def overwrite_payload( collection_name:, payload:, wait: nil, ordering: nil, points: nil, filter: nil ) response = client.connection.put("collections/#{collection_name}/#{PATH}/payload") do |req| req.params["wait"] = wait unless wait.nil? req.params["ordering"] = ordering unless ordering.nil? req.body = {} req.body["payload"] = payload req.body["points"] = points unless points.nil? req.body["filter"] = filter unless filter.nil? end response.body end |
#recommend(collection_name:, positive:, limit:, negative: nil, filter: nil, params: nil, offset: nil, with_payload: nil, with_vector: nil, score_threshold: nil, using: nil, lookup_from: nil, consistency: nil) ⇒ Object
Look for the points which are closer to stored positive examples and at the same time further to negative examples.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/qdrant/points.rb', line 248 def recommend( collection_name:, positive:, limit:, negative: nil, filter: nil, params: nil, offset: nil, with_payload: nil, with_vector: nil, score_threshold: nil, using: nil, lookup_from: nil, consistency: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/recommend") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["positive"] = positive req.body["negative"] = negative unless negative.nil? req.body["limit"] = limit req.body["filter"] = filter unless filter.nil? req.body["params"] = params unless params.nil? req.body["offset"] = offset unless offset.nil? req.body["with_payload"] = with_payload unless with_payload.nil? req.body["with_vector"] = with_vector unless with_vector.nil? req.body["score_threshold"] = score_threshold unless score_threshold.nil? req.body["using"] = using unless using.nil? req.body["lookup_from"] = lookup_from unless lookup_from.nil? end response.body end |
#scroll(collection_name:, limit:, filter: nil, offset: nil, with_payload: nil, with_vector: nil, consistency: nil) ⇒ Object
Scroll request - paginate over all points which matches given filtering condition
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/qdrant/points.rb', line 181 def scroll( collection_name:, limit:, filter: nil, offset: nil, with_payload: nil, with_vector: nil, consistency: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/scroll") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["limit"] = limit req.body["filter"] = filter unless filter.nil? req.body["offset"] = offset unless offset.nil? req.body["with_payload"] = with_payload unless with_payload.nil? req.body["with_vector"] = with_vector unless with_vector.nil? end response.body end |
#search(collection_name:, vector:, limit:, filter: nil, params: nil, offset: nil, with_payload: nil, with_vector: nil, score_threshold: nil, consistency: nil) ⇒ Object
Retrieve closest points based on vector similarity and given filtering conditions
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/qdrant/points.rb', line 204 def search( collection_name:, vector:, limit:, filter: nil, params: nil, offset: nil, with_payload: nil, with_vector: nil, score_threshold: nil, consistency: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/search") do |req| req.params["consistency"] = consistency unless consistency.nil? req.body = {} req.body["vector"] = vector req.body["limit"] = limit req.body["filter"] = filter unless filter.nil? req.body["params"] = params unless params.nil? req.body["offset"] = offset unless offset.nil? req.body["with_payload"] = with_payload unless with_payload.nil? req.body["with_vector"] = with_vector unless with_vector.nil? req.body["score_threshold"] = score_threshold unless score_threshold.nil? end response.body end |
#set_payload(collection_name:, payload:, wait: nil, ordering: nil, points: nil, filter: nil) ⇒ Object
Set payload values for points
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/qdrant/points.rb', line 101 def set_payload( collection_name:, payload:, wait: nil, ordering: nil, points: nil, filter: nil ) response = client.connection.post("collections/#{collection_name}/#{PATH}/payload") do |req| req.params["wait"] = wait unless wait.nil? req.params["ordering"] = ordering unless ordering.nil? req.body = {} req.body["payload"] = payload req.body["points"] = points unless points.nil? req.body["filter"] = filter unless filter.nil? end response.body end |
#upsert(collection_name:, wait: nil, ordering: nil, batch: nil, points: nil) ⇒ Object
Perform insert + updates on points. If point with given ID already exists - it will be overwritten.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/qdrant/points.rb', line 27 def upsert( collection_name:, wait: nil, ordering: nil, batch: nil, points: nil ) response = client.connection.put("collections/#{collection_name}/#{PATH}") do |req| req.params = {} req.params["wait"] = wait unless wait.nil? req.params["ordering"] = ordering unless ordering.nil? req.body = {} req.body["batch"] = batch unless batch.nil? req.body["points"] = points unless points.nil? end response.body end |