Skip to content

Commit

Permalink
Fixed soft_deprecate warnings in meilisearch-ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
yassun committed Sep 5, 2024
1 parent 5b57c6b commit 48bf7f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/meilisearch-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/meilisearch/rails/ms_clean_up_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions spec/system/tech_shop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 48bf7f0

Please sign in to comment.