From 48bf7f0247f21476ec34ef7d69154677e56745ae Mon Sep 17 00:00:00 2001 From: yassun Date: Thu, 5 Sep 2024 07:38:04 +0900 Subject: [PATCH] Fixed soft_deprecate warnings in meilisearch-ruby --- lib/meilisearch-rails.rb | 8 ++++---- lib/meilisearch/rails/ms_clean_up_job.rb | 2 +- spec/system/tech_shop_spec.rb | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/meilisearch-rails.rb b/lib/meilisearch-rails.rb index b2577a67..163a1e0c 100644 --- a/lib/meilisearch-rails.rb +++ b/lib/meilisearch-rails.rb @@ -567,14 +567,14 @@ def ms_index!(document, synchronous = false) doc = doc.merge ms_pk(options) => primary_key if synchronous || options[:synchronous] - index.add_documents!(doc) + index.add_documents(doc).await else index.add_documents(doc) end elsif ms_conditional_index?(options) && primary_key.present? # remove non-indexable documents if synchronous || options[:synchronous] - index.delete_document!(primary_key) + index.delete_document(primary_key).await else index.delete_document(primary_key) end @@ -606,7 +606,7 @@ def ms_remove_from_index!(document, synchronous = false) index = ms_ensure_init(options, settings) if synchronous || options[:synchronous] - index.delete_document!(primary_key) + index.delete_document(primary_key).await else index.delete_document(primary_key) end @@ -619,7 +619,7 @@ def ms_clear_index!(synchronous = false) next if ms_indexing_disabled?(options) index = ms_ensure_init(options, settings) - synchronous || options[:synchronous] ? index.delete_all_documents! : index.delete_all_documents + synchronous || options[:synchronous] ? index.delete_all_documents.await : index.delete_all_documents @ms_indexes[MeiliSearch::Rails.active?][settings] = nil end nil diff --git a/lib/meilisearch/rails/ms_clean_up_job.rb b/lib/meilisearch/rails/ms_clean_up_job.rb index f52fc935..979b206a 100644 --- a/lib/meilisearch/rails/ms_clean_up_job.rb +++ b/lib/meilisearch/rails/ms_clean_up_job.rb @@ -8,7 +8,7 @@ def perform(documents) index = MeiliSearch::Rails.client.index(document[:index_uid]) if document[:synchronous] - index.delete_document!(document[:primary_key]) + index.delete_document(document[:primary_key]).await else index.delete_document(document[:primary_key]) end diff --git a/spec/system/tech_shop_spec.rb b/spec/system/tech_shop_spec.rb index 680be3ac..b5f5a023 100644 --- a/spec/system/tech_shop_spec.rb +++ b/spec/system/tech_shop_spec.rb @@ -122,15 +122,15 @@ context 'when a document cannot be found in ActiveRecord' do it 'does not throw an exception' do - Product.index.add_documents!(@palmpre.attributes.merge(id: -1)) + Product.index.add_documents(@palmpre.attributes.merge(id: -1)).await expect { Product.search('pal') }.not_to raise_error - Product.index.delete_document!(-1) + Product.index.delete_document(-1).await end it 'returns other available results' do - Product.index.add_documents!(@palmpre.attributes.merge(id: -1)) + Product.index.add_documents(@palmpre.attributes.merge(id: -1)).await expect(Product.search('pal').size).to eq(2) - Product.index.delete_document!(-1) + Product.index.delete_document(-1).await end end