Skip to content

Changes related to the next Meilisearch release (v0.28.0) #156

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

Merged
merged 3 commits into from
Jul 12, 2022
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ To learn more about Meilisearch, check out our [Documentation](https://docs.meil

## 🤖 Compatibility with Meilisearch

This package only guarantees the compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).

## 🔧 Installation <!-- omit in toc -->

Expand Down
14 changes: 7 additions & 7 deletions lib/meilisearch-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def self.log_or_throw(method, raise_on_failure, &block)
case method.to_s
when 'search'
# some attributes are required
{ 'hits' => [], 'hitsPerPage' => 0, 'page' => 0, 'facetsDistribution' => {}, 'error' => e }
{ 'hits' => [], 'hitsPerPage' => 0, 'page' => 0, 'facetDistribution' => {}, 'error' => e }
else
# empty answer
{ 'error' => e }
Expand Down Expand Up @@ -460,7 +460,7 @@ def ms_reindex!(batch_size = MeiliSearch::Rails::IndexSettings::DEFAULT_BATCH_SI
end
last_task = index.add_documents(documents)
end
index.wait_for_task(last_task['uid']) if last_task && (synchronous || options[:synchronous])
index.wait_for_task(last_task['taskUid']) if last_task && (synchronous || options[:synchronous])
end
nil
end
Expand All @@ -476,7 +476,7 @@ def ms_set_settings(synchronous = false)

index = SafeIndex.new(ms_index_uid(options), true, options)
task = index.update_settings(final_settings)
index.wait_for_task(task['uid']) if synchronous
index.wait_for_task(task['taskUid']) if synchronous
end
end

Expand All @@ -486,7 +486,7 @@ def ms_index_documents(documents, synchronous = false)

index = ms_ensure_init(options, settings)
task = index.add_documents(documents.map { |d| settings.get_attributes(d).merge ms_pk(options) => ms_primary_key_of(d, options) })
index.wait_for_task(task['uid']) if synchronous || options[:synchronous]
index.wait_for_task(task['taskUid']) if synchronous || options[:synchronous]
end
end

Expand Down Expand Up @@ -583,7 +583,7 @@ def ms_raw_answer
end

def ms_facets_distribution
@ms_json['facetsDistribution']
@ms_json['facetDistribution']
end

private
Expand All @@ -605,8 +605,8 @@ def ms_search(query, params = {})
end

# Returns raw json hits as follows:
# {"hits"=>[{"id"=>"13", "href"=>"apple", "name"=>"iphone"}], "offset"=>0, "limit"=>|| 20, "nbHits"=>1,
# "exhaustiveNbHits"=>false, "processingTimeMs"=>0, "query"=>"iphone"}
# {"hits"=>[{"id"=>"13", "href"=>"apple", "name"=>"iphone"}], "offset"=>0, "limit"=>|| 20, "estimatedTotalHits"=>1,
# "processingTimeMs"=>0, "query"=>"iphone"}
json = ms_raw_search(query, params)

# Returns the ids of the hits: 13
Expand Down
2 changes: 1 addition & 1 deletion meilisearch-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 2.6.0'

s.add_dependency 'meilisearch', '~> 0.18'
s.add_dependency 'meilisearch', '~> 0.19'
end
4 changes: 2 additions & 2 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ class SerializedDocument < ActiveRecord::Base
end

it 'returns facets distribution' do
results = Color.search('', { facetsDistribution: ['short_name'] })
results = Color.search('', { facets: ['short_name'] })
expect(results.raw_answer).not_to be_nil
expect(results.facets_distribution).not_to be_nil
expect(results.facets_distribution.size).to eq(1)
Expand All @@ -753,7 +753,7 @@ class SerializedDocument < ActiveRecord::Base
it 'is raw searchable' do
results = Color.raw_search('blue')
expect(results['hits'].size).to eq(1)
expect(results['nbHits']).to eq(1)
expect(results['estimatedTotalHits']).to eq(1)
end

it 'is able to temporarily disable auto-indexing' do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def safe_index_uid(name)

# get a list of safe indexes in local or CI
def safe_index_list
list = MeiliSearch::Rails.client.indexes
list = MeiliSearch::Rails.client.indexes['results']
list = list.select { |index| index.uid.include?(SAFE_INDEX_PREFIX) }
list.sort_by { |index| index.primary_key || '' }
end