diff --git a/README.md b/README.md index 8d5ffc4..fd3c032 100644 --- a/README.md +++ b/README.md @@ -64,19 +64,16 @@ client.collections.get_stats(collection_name: "example_collection") # Creating a new collection schema client.collections.create( collection_name: "example_collection", - description: "Book search", auto_id: true, fields: [ { fieldName: "book_id", - description: "Book ID", isPrimary: true, autoID: false, dataType: "Int64" }, { fieldName: "content", - description: "Chunk Content", dataType: "VarChar", elementTypeParams: { max_length: "512" @@ -84,7 +81,6 @@ client.collections.create( }, { fieldName: "vector", - description: "Chunk Embedding", dataType: "FloatVector", elementTypeParams: { dim: 1536 diff --git a/lib/milvus/collections.rb b/lib/milvus/collections.rb index 6c4552d..ba5212e 100644 --- a/lib/milvus/collections.rb +++ b/lib/milvus/collections.rb @@ -12,7 +12,7 @@ def has(collection_name:) response = client.connection.post("#{PATH}/has") do |req| req.body = { collectionName: collection_name - }.to_json + } end response.body end @@ -40,7 +40,7 @@ def get_stats(collection_name:) response = client.connection.post("#{PATH}/get_stats") do |req| req.body = { collectionName: collection_name - }.to_json + } end response.body end @@ -55,7 +55,6 @@ def get_stats(collection_name:) def create( collection_name:, auto_id:, - description:, fields: ) response = client.connection.post("#{PATH}/create") do |req| @@ -63,11 +62,10 @@ def create( collectionName: collection_name, schema: { autoId: auto_id, - description: description, fields: fields, name: collection_name # This duplicated field is kept for historical reasons. } - }.to_json + } end response.body.empty? ? true : response.body end @@ -80,7 +78,7 @@ def describe(collection_name:) response = client.connection.post("#{PATH}/describe") do |req| req.body = { collectionName: collection_name - }.to_json + } end response.body end @@ -103,7 +101,7 @@ def drop(collection_name:) response = client.connection.post("#{PATH}/drop") do |req| req.body = { collectionName: collection_name - }.to_json + } end response.body.empty? ? true : response.body end @@ -142,7 +140,7 @@ def release(collection_name:) response = client.connection.post("#{PATH}/release") do |req| req.body = { collectionName: collection_name - }.to_json + } end response.body.empty? ? true : response.body end diff --git a/lib/milvus/entities.rb b/lib/milvus/entities.rb index 7f7a194..4d4e8b1 100644 --- a/lib/milvus/entities.rb +++ b/lib/milvus/entities.rb @@ -21,7 +21,6 @@ def insert( collectionName: collection_name, data: data } - req.body[:partitionName] = partition_name if partition_name end response.body.empty? ? true : response.body @@ -40,7 +39,7 @@ def delete( req.body = { collectionName: collection_name, filter: filter - }.to_json + } end response.body.empty? ? true : response.body end @@ -84,7 +83,6 @@ def upsert( collectionName: collection_name, data: data } - req.body[:partitionName] = partition_name if partition_name end response.body.empty? ? true : response.body diff --git a/lib/milvus/indexes.rb b/lib/milvus/indexes.rb index 9e117f5..f180a6c 100644 --- a/lib/milvus/indexes.rb +++ b/lib/milvus/indexes.rb @@ -17,7 +17,7 @@ def create( req.body = { collectionName: collection_name, indexParams: index_params - }.to_json + } end response.body.empty? ? true : response.body end @@ -35,7 +35,7 @@ def drop( req.body = { collectionName: collection_name, indexName: index_name - }.to_json + } end response.body.empty? ? true : response.body end @@ -53,7 +53,7 @@ def describe( req.body = { collectionName: collection_name, indexName: index_name - }.to_json + } end response.body.empty? ? true : response.body end @@ -68,7 +68,7 @@ def list( response = client.connection.post("#{PATH}/list") do |req| req.body = { collectionName: collection_name - }.to_json + } end response.body.empty? ? true : response.body end diff --git a/spec/milvus/collections_spec.rb b/spec/milvus/collections_spec.rb index 8984e88..6d32ce2 100644 --- a/spec/milvus/collections_spec.rb +++ b/spec/milvus/collections_spec.rb @@ -62,14 +62,13 @@ describe "#create" do let(:collection_name) { "test_collection" } let(:auto_id) { true } - let(:description) { "Test collection" } let(:fields) { [{name: "field1", type: "int64"}] } let(:response_body) { File.read("spec/fixtures/collections/create.json") } let(:response) { instance_double("Faraday::Response", body: response_body) } it "creates a collection" do expect(connection).to receive(:post).with("collections/create").and_return(response) - result = collections.create(collection_name: collection_name, auto_id: auto_id, description: description, fields: fields) + result = collections.create(collection_name: collection_name, auto_id: auto_id, fields: fields) expect(result).to eq(response_body) end end