@@ -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)
@@ -295,7 +295,7 @@ This gem supports:
295295Specify the ` :pagination_backend ` in the configuration file:
296296
297297``` ruby
298- MeiliSearch ::Rails .configuration = {
298+ Meilisearch ::Rails .configuration = {
299299 meilisearch_url: ' YourMeilisearchUrl' ,
300300 meilisearch_api_key: ' YourMeilisearchAPIKey' ,
301301 pagination_backend: :kaminari # :will_paginate
@@ -344,7 +344,7 @@ Then in your model you must extend `Pagy::Meilisearch`:
344344
345345``` rb
346346class Book < ApplicationRecord
347- include MeiliSearch ::Rails
347+ include Meilisearch ::Rails
348348 extend Pagy ::Meilisearch
349349
350350 meilisearch # ...
365365< %= = pagy_nav(@pagy ) %>
366366```
367367
368- :warning: There is no need to set `pagination_backend` in the configuration block `MeiliSearch ::Rails.configuration` for `pagy`.
368+ :warning: There is no need to set `pagination_backend` in the configuration block `Meilisearch ::Rails.configuration` for `pagy`.
369369
370370Check [`ddnexus/pagy`](https://ddnexus.github.io/pagy/extras/meilisearch) for more information.
371371
@@ -377,7 +377,7 @@ you have multiple ways to achieve this.
377377By adding ` active: false` in the configuration initializer:
378378
379379` ` ` ruby
380- MeiliSearch ::Rails.configuration = {
380+ Meilisearch ::Rails.configuration = {
381381 meilisearch_url: 'YourMeilisearchUrl',
382382 meilisearch_api_key: 'YourMeilisearchAPIKey',
383383 active: false
@@ -387,11 +387,11 @@ MeiliSearch::Rails.configuration = {
387387Or you can disable programmatically:
388388
389389` ` ` ruby
390- MeiliSearch ::Rails.deactivate! # all the following HTTP calls will be dismissed.
390+ Meilisearch ::Rails.deactivate! # all the following HTTP calls will be dismissed.
391391
392392# or you can pass a block to it:
393393
394- MeiliSearch ::Rails.deactivate! do
394+ Meilisearch ::Rails.deactivate! do
395395 # every Meilisearch call here will be dismissed, no error will be raised.
396396 # after the block, Meilisearch state will be active.
397397end
400400You can also activate if you deactivated earlier:
401401
402402` ` ` ruby
403- MeiliSearch ::Rails.activate!
403+ Meilisearch ::Rails.activate!
404404` ` `
405405
406406:warning : These calls are persistent, so prefer to use the method with the block. This way, you will not forget to activate it afterward.
@@ -411,7 +411,7 @@ By default, the **index_uid** will be the class name, e.g. `Book`. You can custo
411411
412412` ` ` ruby
413413class Book < ActiveRecord::Base
414- include MeiliSearch ::Rails
414+ include Meilisearch ::Rails
415415
416416 meilisearch index_uid: 'MyCustomUID'
417417end
422422You can suffix the index UID with the current Rails environment by setting it globally:
423423
424424` ` ` ruby
425- MeiliSearch ::Rails.configuration = {
425+ Meilisearch ::Rails.configuration = {
426426 meilisearch_url: 'YourMeilisearchUrl',
427427 meilisearch_api_key: 'YourMeilisearchAPIKey',
428428 per_environment: true
@@ -441,7 +441,7 @@ You can add a custom attribute by using the `add_attribute` option or by using a
441441
442442```ruby
443443class Author < ApplicationRecord
444- include MeiliSearch ::Rails
444+ include Meilisearch ::Rails
445445
446446 meilisearch do
447447 attribute :first_name, :last_name
@@ -473,7 +473,7 @@ Note that the primary key must return a **unique value** otherwise your data cou
473473
474474` ` ` ruby
475475class Book < ActiveRecord::Base
476- include MeiliSearch ::Rails
476+ include Meilisearch ::Rails
477477
478478 meilisearch primary_key: :isbn # isbn is a column in your table definition.
479479end
@@ -484,7 +484,7 @@ will be used as the reference to the document when Meilisearch needs it.
484484
485485` ` ` rb
486486class Book < ActiveRecord::Base
487- include MeiliSearch ::Rails
487+ include Meilisearch ::Rails
488488
489489 meilisearch primary_key: :my_custom_ms_id
490490
@@ -503,7 +503,7 @@ As soon as you use those constraints, `add_documents` and `delete_documents` cal
503503
504504` ` ` ruby
505505class Book < ActiveRecord::Base
506- include MeiliSearch ::Rails
506+ include Meilisearch ::Rails
507507
508508 meilisearch if: :published?, unless: :premium?
509509
@@ -526,7 +526,7 @@ You can index a record in several indexes using the `add_index` option:
526526
527527` ` ` ruby
528528class Book < ActiveRecord::Base
529- include MeiliSearch ::Rails
529+ include Meilisearch ::Rails
530530
531531 PUBLIC_INDEX_UID = 'Books'
532532 SECURED_INDEX_UID = 'PrivateBooks'
@@ -555,7 +555,7 @@ You may want to share an index between several models. You'll need to ensure you
555555
556556` ` ` ruby
557557class Cat < ActiveRecord::Base
558- include MeiliSearch ::Rails
558+ include Meilisearch ::Rails
559559
560560 meilisearch index_uid: 'Animals', primary_key: :ms_id
561561
@@ -567,7 +567,7 @@ class Cat < ActiveRecord::Base
567567end
568568
569569class Dog < ActiveRecord::Base
570- include MeiliSearch ::Rails
570+ include Meilisearch ::Rails
571571
572572 meilisearch index_uid: 'Animals', primary_key: :ms_id
573573
@@ -585,7 +585,7 @@ You can configure the auto-indexing & auto-removal process to use a queue to per
585585
586586` ` ` ruby
587587class Book < ActiveRecord::Base
588- include MeiliSearch ::Rails
588+ include Meilisearch ::Rails
589589
590590 meilisearch enqueue: true # ActiveJob will be triggered using a ` meilisearch` queue
591591end
@@ -599,7 +599,7 @@ With **ActiveJob**:
599599
600600` ` ` ruby
601601class Book < ActiveRecord::Base
602- include MeiliSearch ::Rails
602+ include Meilisearch ::Rails
603603
604604 meilisearch enqueue: :trigger_job do
605605 attribute :title, :author, :description
@@ -629,7 +629,7 @@ With [**Sidekiq**](https://github.com/mperham/sidekiq):
629629
630630` ` ` ruby
631631class Book < ActiveRecord::Base
632- include MeiliSearch ::Rails
632+ include Meilisearch ::Rails
633633
634634 meilisearch enqueue: :trigger_sidekiq_job do
635635 attribute :title, :author, :description
@@ -659,7 +659,7 @@ With [**DelayedJob**](https://github.com/collectiveidea/delayed_job):
659659
660660` ` ` ruby
661661class Book < ActiveRecord::Base
662- include MeiliSearch ::Rails
662+ include Meilisearch ::Rails
663663
664664 meilisearch enqueue: :trigger_delayed_job do
665665 attribute :title, :author, :description
@@ -683,7 +683,7 @@ Extend a change to a related record.
683683
684684```ruby
685685class Author < ActiveRecord::Base
686- include MeiliSearch ::Rails
686+ include Meilisearch ::Rails
687687
688688 has_many :books
689689 # If your association uses belongs_to
@@ -693,7 +693,7 @@ class Author < ActiveRecord::Base
693693end
694694
695695class Book < ActiveRecord::Base
696- include MeiliSearch ::Rails
696+ include Meilisearch ::Rails
697697
698698 belongs_to :author
699699 after_touch :index!
@@ -712,7 +712,7 @@ With **Sequel**, you can use the `touch` plugin to propagate changes.
712712```ruby
713713# app/models/author.rb
714714class Author < Sequel::Model
715- include MeiliSearch ::Rails
715+ include Meilisearch ::Rails
716716
717717 one_to_many :books
718718
734734
735735# app/models/book.rb
736736class Book < Sequel::Model
737- include MeiliSearch ::Rails
737+ include Meilisearch ::Rails
738738
739739 many_to_one :author
740740 after_touch :index!
@@ -757,7 +757,7 @@ You can strip all HTML tags from your attributes with the `sanitize` option.
757757
758758```ruby
759759class Book < ActiveRecord::Base
760- include MeiliSearch ::Rails
760+ include Meilisearch ::Rails
761761
762762 meilisearch sanitize: true
763763end
@@ -769,7 +769,7 @@ You can force the UTF-8 encoding of all your attributes using the `force_utf8_en
769769
770770```ruby
771771class Book < ActiveRecord::Base
772- include MeiliSearch ::Rails
772+ include Meilisearch ::Rails
773773
774774 meilisearch force_utf8_encoding: true
775775end
@@ -781,7 +781,7 @@ You can eager load associations using `meilisearch_import` scope.
781781
782782```ruby
783783class Author < ActiveRecord::Base
784- include MeiliSearch ::Rails
784+ include Meilisearch ::Rails
785785
786786 has_many :books
787787
@@ -834,7 +834,7 @@ You can disable exceptions that could be raised while trying to reach Meilisearc
834834
835835``` ruby
836836class Book < ActiveRecord ::Base
837- include MeiliSearch ::Rails
837+ include Meilisearch ::Rails
838838
839839 # Only raise exceptions in development environment.
840840 meilisearch raise_on_failure: Rails .env.development?
@@ -849,7 +849,7 @@ You can force indexing and removing to be synchronous by setting the following o
849849
850850``` ruby
851851class Book < ActiveRecord ::Base
852- include MeiliSearch ::Rails
852+ include Meilisearch ::Rails
853853
854854 meilisearch synchronous: true
855855end
@@ -862,7 +862,7 @@ You can disable auto-indexing and auto-removing setting the following options:
862862
863863``` ruby
864864class Book < ActiveRecord ::Base
865- include MeiliSearch ::Rails
865+ include Meilisearch ::Rails
866866
867867 meilisearch auto_index: false , auto_remove: false
868868end
0 commit comments