From a9bb8c327012c02a97dda983307057d0c2abda47 Mon Sep 17 00:00:00 2001 From: "ronan.louarn" Date: Fri, 21 Nov 2025 19:53:39 +0100 Subject: [PATCH 1/3] fix(collection) Fix #create_index method The readme says that we can pass and as parameter, but we can't. So here is the fix --- Gemfile.lock | 2 +- lib/qdrant/collections.rb | 11 +++++--- spec/qdrant/collections_spec.rb | 46 +++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a84d687..8fa1701 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - qdrant-ruby (0.9.9) + qdrant-ruby (0.9.10) faraday (>= 2.0.1, < 3) GEM diff --git a/lib/qdrant/collections.rb b/lib/qdrant/collections.rb index 3d43b97..baa5a14 100644 --- a/lib/qdrant/collections.rb +++ b/lib/qdrant/collections.rb @@ -91,12 +91,15 @@ def update_aliases(actions:) def create_index( collection_name:, field_name:, - field_schema: nil + field_schema: nil, + wait: nil, + ordering: nil ) response = client.connection.put("#{PATH}/#{collection_name}/index") do |req| - req.body = { - field_name: field_name - } + req.params["ordering"] = ordering unless ordering.nil? + # Add explicit false check to avoid nil case. True is default behavior. + req.params["wait"] = wait unless wait.nil? + req.body = { field_name: field_name } req.body["field_schema"] = field_schema unless field_schema.nil? end diff --git a/spec/qdrant/collections_spec.rb b/spec/qdrant/collections_spec.rb index f368b33..bdd74a6 100644 --- a/spec/qdrant/collections_spec.rb +++ b/spec/qdrant/collections_spec.rb @@ -159,6 +159,52 @@ expect(response.dig("status")).to eq("ok") expect(response.dig("result")).to eq(true) end + + it "adds wait=false query param when specified" do + allow_any_instance_of(Faraday::Connection).to receive(:put) + .with("collections/test_collection/index?wait=false") + .and_return(response) + + response = collections.create_index( + collection_name: "test_collection", + field_name: "description", + field_schema: "text", + wait: false + ) + expect(response.dig("status")).to eq("ok") + expect(response.dig("result")).to eq(true) + end + + it "adds ordering query param when specified" do + allow_any_instance_of(Faraday::Connection).to receive(:put) + .with("collections/test_collection/index?ordering=weak") + .and_return(response) + + response = collections.create_index( + collection_name: "test_collection", + field_name: "description", + field_schema: "text", + ordering: "weak" + ) + expect(response.dig("status")).to eq("ok") + expect(response.dig("result")).to eq(true) + end + + it "adds both wait=false and ordering params when specified" do + allow_any_instance_of(Faraday::Connection).to receive(:put) + .with("collections/test_collection/index?ordering=weak&wait=false") + .and_return(response) + + response = collections.create_index( + collection_name: "test_collection", + field_name: "description", + field_schema: "text", + ordering: "weak", + wait: false + ) + expect(response.dig("status")).to eq("ok") + expect(response.dig("result")).to eq(true) + end end describe "#delete_index" do From 10426b7b317c05b47648d782706afb6fa6fe82ec Mon Sep 17 00:00:00 2001 From: "ronan.louarn" Date: Fri, 21 Nov 2025 19:56:55 +0100 Subject: [PATCH 2/3] chore(version) Upgrade the version --- lib/qdrant/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/qdrant/version.rb b/lib/qdrant/version.rb index 6b5963d..9c482a2 100644 --- a/lib/qdrant/version.rb +++ b/lib/qdrant/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Qdrant - VERSION = "0.9.9" + VERSION = "0.9.10" end From 4021d7b1c6603fc47f92694b5981f5164a8aad84 Mon Sep 17 00:00:00 2001 From: Ronan LOUARN Date: Sun, 23 Nov 2025 20:21:59 +0100 Subject: [PATCH 3/3] chore(linter) Fix linter errors --- lib/qdrant/collections.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/qdrant/collections.rb b/lib/qdrant/collections.rb index baa5a14..1ac94c6 100644 --- a/lib/qdrant/collections.rb +++ b/lib/qdrant/collections.rb @@ -99,7 +99,7 @@ def create_index( req.params["ordering"] = ordering unless ordering.nil? # Add explicit false check to avoid nil case. True is default behavior. req.params["wait"] = wait unless wait.nil? - req.body = { field_name: field_name } + req.body = {field_name: field_name} req.body["field_schema"] = field_schema unless field_schema.nil? end