@@ -98,7 +98,7 @@ gem 'meilisearch-rails'
9898Create a new file ` config/initializers/meilisearch.rb ` to setup your ` MEILISEARCH_HOST ` and ` MEILISEARCH_API_KEY `
9999
100100``` ruby
101- MeiliSearch ::Rails .configuration = {
101+ Meilisearch ::Rails .configuration = {
102102 meilisearch_url: ENV .fetch(' MEILISEARCH_HOST' , ' http://localhost:7700' ),
103103 meilisearch_api_key: ENV .fetch(' MEILISEARCH_API_KEY' , ' YourMeilisearchAPIKey' )
104104}
@@ -120,7 +120,7 @@ The following code will create a `Book` index and add search capabilities to you
120120
121121``` ruby
122122class Book < ActiveRecord ::Base
123- include MeiliSearch ::Rails
123+ include Meilisearch ::Rails
124124
125125 meilisearch do
126126 attribute :title , :author # only the attributes 'title', and 'author' will be sent to Meilisearch
@@ -154,7 +154,7 @@ Requests made to Meilisearch may timeout and retry. To adapt the behavior to
154154your needs, you can change the parameters during configuration:
155155
156156``` ruby
157- MeiliSearch ::Rails .configuration = {
157+ Meilisearch ::Rails .configuration = {
158158 meilisearch_url: ' YourMeilisearchUrl' ,
159159 meilisearch_api_key: ' YourMeilisearchAPIKey' ,
160160 timeout: 2 ,
@@ -172,7 +172,7 @@ You can configure the index settings by adding them inside the `meilisearch` blo
172172
173173``` ruby
174174class Book < ApplicationRecord
175- include MeiliSearch ::Rails
175+ include Meilisearch ::Rails
176176
177177 meilisearch do
178178 searchable_attributes [:title , :author , :publisher , :description ]
@@ -235,7 +235,7 @@ Book.search('*', sort: ['title:asc'])
235235Meilisearch supports searching multiple models at the same time (see [ 🔍 Custom search] ( #-custom-search ) for search options):
236236
237237``` ruby
238- multi_search_results = MeiliSearch ::Rails .multi_search(
238+ multi_search_results = Meilisearch ::Rails .multi_search(
239239 Book => { q: ' Harry' },
240240 Manga => { q: ' Attack' }
241241)
@@ -268,7 +268,7 @@ Use `#each_result` to loop through pairs of your provided keys and the results:
268268Records are loaded when the keys are models, or when ` :class_name ` option is passed:
269269
270270``` ruby
271- multi_search_results = MeiliSearch ::Rails .multi_search(
271+ multi_search_results = Meilisearch ::Rails .multi_search(
272272 ' books' => { q: ' Harry' , class_name: ' Book' },
273273 ' mangas' => { q: ' Attack' , class_name: ' Manga' }
274274)
@@ -279,7 +279,7 @@ Otherwise, hashes are returned.
279279The index to search is inferred from the model if the key is a model, if the key is a string the key is assumed to be the index unless the ` :index_uid ` option is passed:
280280
281281``` ruby
282- multi_search_results = MeiliSearch ::Rails .multi_search(
282+ multi_search_results = Meilisearch ::Rails .multi_search(
283283 ' western' => { q: ' Harry' , class_name: ' Book' , index_uid: ' books_production' },
284284 ' japanese' => { q: ' Attack' , class_name: ' Manga' , index_uid: ' mangas_production' }
285285)
@@ -291,7 +291,7 @@ You can search the same index multiple times by specifying `:index_uid`:
291291
292292``` ruby
293293query = ' hero'
294- multi_search_results = MeiliSearch ::Rails .multi_search(
294+ multi_search_results = Meilisearch ::Rails .multi_search(
295295 ' Isekai Manga' => { q: query, class_name: ' Manga' , filters: ' genre:isekai' , index_uid: ' mangas_production' }
296296 ' Shounen Manga' => { q: query, class_name: ' Manga' , filters: ' genre:shounen' , index_uid: ' mangas_production' }
297297 ' Steampunk Manga' => { q: query, class_name: ' Manga' , filters: ' genre:steampunk' , index_uid: ' mangas_production' }
@@ -333,7 +333,7 @@ This gem supports:
333333Specify the ` :pagination_backend ` in the configuration file:
334334
335335``` ruby
336- MeiliSearch ::Rails .configuration = {
336+ Meilisearch ::Rails .configuration = {
337337 meilisearch_url: ' YourMeilisearchUrl' ,
338338 meilisearch_api_key: ' YourMeilisearchAPIKey' ,
339339 pagination_backend: :kaminari # :will_paginate
@@ -382,7 +382,7 @@ Then in your model you must extend `Pagy::Meilisearch`:
382382
383383``` rb
384384class Book < ApplicationRecord
385- include MeiliSearch ::Rails
385+ include Meilisearch ::Rails
386386 extend Pagy ::Meilisearch
387387
388388 meilisearch # ...
403403< %= = pagy_nav(@pagy ) %>
404404```
405405
406- :warning: There is no need to set `pagination_backend` in the configuration block `MeiliSearch ::Rails.configuration` for `pagy`.
406+ :warning: There is no need to set `pagination_backend` in the configuration block `Meilisearch ::Rails.configuration` for `pagy`.
407407
408408Check [`ddnexus/pagy`](https://ddnexus.github.io/pagy/extras/meilisearch) for more information.
409409
@@ -415,7 +415,7 @@ you have multiple ways to achieve this.
415415By adding ` active: false` in the configuration initializer:
416416
417417` ` ` ruby
418- MeiliSearch ::Rails.configuration = {
418+ Meilisearch ::Rails.configuration = {
419419 meilisearch_url: 'YourMeilisearchUrl',
420420 meilisearch_api_key: 'YourMeilisearchAPIKey',
421421 active: false
@@ -425,11 +425,11 @@ MeiliSearch::Rails.configuration = {
425425Or you can disable programmatically:
426426
427427` ` ` ruby
428- MeiliSearch ::Rails.deactivate! # all the following HTTP calls will be dismissed.
428+ Meilisearch ::Rails.deactivate! # all the following HTTP calls will be dismissed.
429429
430430# or you can pass a block to it:
431431
432- MeiliSearch ::Rails.deactivate! do
432+ Meilisearch ::Rails.deactivate! do
433433 # every Meilisearch call here will be dismissed, no error will be raised.
434434 # after the block, Meilisearch state will be active.
435435end
438438You can also activate if you deactivated earlier:
439439
440440` ` ` ruby
441- MeiliSearch ::Rails.activate!
441+ Meilisearch ::Rails.activate!
442442` ` `
443443
444444:warning : These calls are persistent, so prefer to use the method with the block. This way, you will not forget to activate it afterward.
@@ -449,7 +449,7 @@ By default, the **index_uid** will be the class name, e.g. `Book`. You can custo
449449
450450` ` ` ruby
451451class Book < ActiveRecord::Base
452- include MeiliSearch ::Rails
452+ include Meilisearch ::Rails
453453
454454 meilisearch index_uid: 'MyCustomUID'
455455end
460460You can suffix the index UID with the current Rails environment by setting it globally:
461461
462462` ` ` ruby
463- MeiliSearch ::Rails.configuration = {
463+ Meilisearch ::Rails.configuration = {
464464 meilisearch_url: 'YourMeilisearchUrl',
465465 meilisearch_api_key: 'YourMeilisearchAPIKey',
466466 per_environment: true
@@ -479,7 +479,7 @@ You can add a custom attribute by using the `add_attribute` option or by using a
479479
480480```ruby
481481class Author < ApplicationRecord
482- include MeiliSearch ::Rails
482+ include Meilisearch ::Rails
483483
484484 meilisearch do
485485 attribute :first_name, :last_name
@@ -511,7 +511,7 @@ Note that the primary key must return a **unique value** otherwise your data cou
511511
512512` ` ` ruby
513513class Book < ActiveRecord::Base
514- include MeiliSearch ::Rails
514+ include Meilisearch ::Rails
515515
516516 meilisearch primary_key: :isbn # isbn is a column in your table definition.
517517end
@@ -522,7 +522,7 @@ will be used as the reference to the document when Meilisearch needs it.
522522
523523` ` ` rb
524524class Book < ActiveRecord::Base
525- include MeiliSearch ::Rails
525+ include Meilisearch ::Rails
526526
527527 meilisearch primary_key: :my_custom_ms_id
528528
@@ -541,7 +541,7 @@ As soon as you use those constraints, `add_documents` and `delete_documents` cal
541541
542542` ` ` ruby
543543class Book < ActiveRecord::Base
544- include MeiliSearch ::Rails
544+ include Meilisearch ::Rails
545545
546546 meilisearch if: :published?, unless: :premium?
547547
@@ -564,7 +564,7 @@ You can index a record in several indexes using the `add_index` option:
564564
565565` ` ` ruby
566566class Book < ActiveRecord::Base
567- include MeiliSearch ::Rails
567+ include Meilisearch ::Rails
568568
569569 PUBLIC_INDEX_UID = 'Books'
570570 SECURED_INDEX_UID = 'PrivateBooks'
@@ -593,7 +593,7 @@ You may want to share an index between several models. You'll need to ensure you
593593
594594` ` ` ruby
595595class Cat < ActiveRecord::Base
596- include MeiliSearch ::Rails
596+ include Meilisearch ::Rails
597597
598598 meilisearch index_uid: 'Animals', primary_key: :ms_id
599599
@@ -605,7 +605,7 @@ class Cat < ActiveRecord::Base
605605end
606606
607607class Dog < ActiveRecord::Base
608- include MeiliSearch ::Rails
608+ include Meilisearch ::Rails
609609
610610 meilisearch index_uid: 'Animals', primary_key: :ms_id
611611
@@ -623,7 +623,7 @@ You can configure the auto-indexing & auto-removal process to use a queue to per
623623
624624` ` ` ruby
625625class Book < ActiveRecord::Base
626- include MeiliSearch ::Rails
626+ include Meilisearch ::Rails
627627
628628 meilisearch enqueue: true # ActiveJob will be triggered using a ` meilisearch` queue
629629end
@@ -637,7 +637,7 @@ With **ActiveJob**:
637637
638638` ` ` ruby
639639class Book < ActiveRecord::Base
640- include MeiliSearch ::Rails
640+ include Meilisearch ::Rails
641641
642642 meilisearch enqueue: :trigger_job do
643643 attribute :title, :author, :description
@@ -667,7 +667,7 @@ With [**Sidekiq**](https://github.com/mperham/sidekiq):
667667
668668` ` ` ruby
669669class Book < ActiveRecord::Base
670- include MeiliSearch ::Rails
670+ include Meilisearch ::Rails
671671
672672 meilisearch enqueue: :trigger_sidekiq_job do
673673 attribute :title, :author, :description
@@ -697,7 +697,7 @@ With [**DelayedJob**](https://github.com/collectiveidea/delayed_job):
697697
698698` ` ` ruby
699699class Book < ActiveRecord::Base
700- include MeiliSearch ::Rails
700+ include Meilisearch ::Rails
701701
702702 meilisearch enqueue: :trigger_delayed_job do
703703 attribute :title, :author, :description
@@ -721,7 +721,7 @@ Extend a change to a related record.
721721
722722```ruby
723723class Author < ActiveRecord::Base
724- include MeiliSearch ::Rails
724+ include Meilisearch ::Rails
725725
726726 has_many :books
727727 # If your association uses belongs_to
@@ -731,7 +731,7 @@ class Author < ActiveRecord::Base
731731end
732732
733733class Book < ActiveRecord::Base
734- include MeiliSearch ::Rails
734+ include Meilisearch ::Rails
735735
736736 belongs_to :author
737737 after_touch :index!
@@ -750,7 +750,7 @@ With **Sequel**, you can use the `touch` plugin to propagate changes.
750750```ruby
751751# app/models/author.rb
752752class Author < Sequel::Model
753- include MeiliSearch ::Rails
753+ include Meilisearch ::Rails
754754
755755 one_to_many :books
756756
772772
773773# app/models/book.rb
774774class Book < Sequel::Model
775- include MeiliSearch ::Rails
775+ include Meilisearch ::Rails
776776
777777 many_to_one :author
778778 after_touch :index!
@@ -795,7 +795,7 @@ You can strip all HTML tags from your attributes with the `sanitize` option.
795795
796796```ruby
797797class Book < ActiveRecord::Base
798- include MeiliSearch ::Rails
798+ include Meilisearch ::Rails
799799
800800 meilisearch sanitize: true
801801end
@@ -807,7 +807,7 @@ You can force the UTF-8 encoding of all your attributes using the `force_utf8_en
807807
808808```ruby
809809class Book < ActiveRecord::Base
810- include MeiliSearch ::Rails
810+ include Meilisearch ::Rails
811811
812812 meilisearch force_utf8_encoding: true
813813end
@@ -819,7 +819,7 @@ You can eager load associations using `meilisearch_import` scope.
819819
820820```ruby
821821class Author < ActiveRecord::Base
822- include MeiliSearch ::Rails
822+ include Meilisearch ::Rails
823823
824824 has_many :books
825825
@@ -872,7 +872,7 @@ You can disable exceptions that could be raised while trying to reach Meilisearc
872872
873873``` ruby
874874class Book < ActiveRecord ::Base
875- include MeiliSearch ::Rails
875+ include Meilisearch ::Rails
876876
877877 # Only raise exceptions in development environment.
878878 meilisearch raise_on_failure: Rails .env.development?
@@ -887,7 +887,7 @@ You can force indexing and removing to be synchronous by setting the following o
887887
888888``` ruby
889889class Book < ActiveRecord ::Base
890- include MeiliSearch ::Rails
890+ include Meilisearch ::Rails
891891
892892 meilisearch synchronous: true
893893end
@@ -900,7 +900,7 @@ You can disable auto-indexing and auto-removing setting the following options:
900900
901901``` ruby
902902class Book < ActiveRecord ::Base
903- include MeiliSearch ::Rails
903+ include Meilisearch ::Rails
904904
905905 meilisearch auto_index: false , auto_remove: false
906906end
0 commit comments