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

Changes related to the next MeiliSearch release (v0.21.0) #47

Merged
merged 13 commits into from
Aug 24, 2021
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "http://rubygems.org"

gem 'json', '~> 2.5', '>= 2.5.1'
gem 'meilisearch', '~> 0.15.3'
gem 'meilisearch', '~> 0.16.0'

if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
gem 'rubysl', '~> 2.0', :platform => :rbx
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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.20.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.20.0).
This package only guarantees the compatibility with the [version v0.21.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.21.0).

## 🔧 Installation

Expand Down Expand Up @@ -207,13 +207,12 @@ class Book < ApplicationRecord

meilisearch do
searchable_attributes [:title, :author, :publisher, :description]
attributes_for_faceting [:genre]
filterable_attributes [:genre]
ranking_rules [
'proximity',
'typo',
'words',
'attribute',
'wordsPosition',
'exactness',
'desc(publication_year)'
]
Expand All @@ -234,7 +233,7 @@ Check the dedicated section of the documentation, for more information on the [s
All the supported options are described in the [search parameters](https://docs.meilisearch.com/reference/features/search_parameters.html) section of the documentation.

```ruby
Book.search('Harry', filters: 'author = J. K. Rowling')
Book.search('Harry', attributesToHighlight: ['*'])
```
👉 Don't forget that `attributes_to_highlight`, `attributes_to_crop`, and
`crop_length` can be set up in the `meilisearch` block of your model.
Expand Down Expand Up @@ -284,13 +283,13 @@ class Author < ApplicationRecord
meilisearch do
attribute :first_name, :last_name
attribute :full_name do
'#{first_name} #{last_name}'
"#{first_name} #{last_name}"
end
add_attribute :full_name_reversed
end

def full_name_reversed
'#{last_name} #{first_name}'
"#{last_name} #{first_name}"
end

def will_save_change_to_full_name?
Expand Down
2 changes: 1 addition & 1 deletion lib/meilisearch-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class IndexSettings
# MeiliSearch settings
OPTIONS = [
:searchableAttributes,
:attributesForFaceting,
:filterableAttributes,
:displayedAttributes,
:distinctAttribute,
:synonyms,
Expand Down
3 changes: 1 addition & 2 deletions playground/app/models/book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ class Book < ApplicationRecord
meilisearch do
# add_attribute :extra_attr
searchable_attributes [:title, :author, :publisher, :description]
attributes_for_faceting [:genre]
filterable_attributes [:genre]
ranking_rules [
'proximity',
'typo',
'words',
'attribute',
'wordsPosition',
'exactness',
'desc(publication_year)',
]
Expand Down
Loading