Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed soft_deprecate warnings in meilisearch-ruby #372

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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