Skip to content

Commit

Permalink
Merge #372
Browse files Browse the repository at this point in the history
372: Fixed soft_deprecate warnings in meilisearch-ruby r=ellnix a=yassun

# Pull Request

## Related issue
N/A

## What does this PR do?
- fixed deprecated warnings from meilisearch-ruby methods.

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: yassun <yasukun.taga@gmail.com>
  • Loading branch information
meili-bors[bot] and yassun authored Sep 13, 2024
2 parents 5b57c6b + 48bf7f0 commit c4abc60
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 c4abc60

Please sign in to comment.