@@ -74,13 +74,13 @@ class << base
7474 alias_method :must_reindex? , :ms_must_reindex? unless method_defined? :must_reindex?
7575 end
7676
77- base . cattr_accessor :meilisearch_options , :meilisearch_settings , :ms_config
77+ base . cattr_accessor :meilisearch_options , :ms_index_settings , :ms_config
7878 end
7979
8080 def meilisearch ( options = { } , &block )
81- self . meilisearch_settings = IndexSettings . new ( options , &block )
81+ self . ms_index_settings = IndexSettings . new ( options , &block )
8282 self . meilisearch_options = {
83- per_page : meilisearch_settings . get_setting ( :hitsPerPage ) || 20 , page : 1
83+ per_page : ms_index_settings . get_setting ( :hitsPerPage ) || 20 , page : 1
8484 } . merge ( options )
8585
8686 self . ms_config = ModelConfiguration . new ( model_name . to_s . constantize , options )
@@ -333,15 +333,15 @@ def ms_clear_index!(synchronous = false)
333333 def ms_raw_search ( q , params = { } )
334334 index_uid = params . delete ( :index ) || params . delete ( 'index' )
335335
336- unless meilisearch_settings . get_setting ( :attributes_to_highlight ) . nil?
337- params [ :attributes_to_highlight ] = meilisearch_settings . get_setting ( :attributes_to_highlight )
336+ unless ms_index_settings . get_setting ( :attributes_to_highlight ) . nil?
337+ params [ :attributes_to_highlight ] = ms_index_settings . get_setting ( :attributes_to_highlight )
338338 end
339339
340- unless meilisearch_settings . get_setting ( :attributes_to_crop ) . nil?
341- params [ :attributes_to_crop ] = meilisearch_settings . get_setting ( :attributes_to_crop )
340+ unless ms_index_settings . get_setting ( :attributes_to_crop ) . nil?
341+ params [ :attributes_to_crop ] = ms_index_settings . get_setting ( :attributes_to_crop )
342342
343- unless meilisearch_settings . get_setting ( :crop_length ) . nil?
344- params [ :crop_length ] = meilisearch_settings . get_setting ( :crop_length )
343+ unless ms_index_settings . get_setting ( :crop_length ) . nil?
344+ params [ :crop_length ] = ms_index_settings . get_setting ( :crop_length )
345345 end
346346 end
347347
@@ -486,8 +486,8 @@ def ms_primary_key_method(options = nil)
486486
487487 protected
488488
489- def ms_ensure_init ( options = meilisearch_options , settings = meilisearch_settings , user_configuration = settings . to_settings )
490- raise ArgumentError , 'No `meilisearch` block found in your model.' if meilisearch_settings . nil?
489+ def ms_ensure_init ( options = meilisearch_options , settings = ms_index_settings , user_configuration = settings . to_settings )
490+ raise ArgumentError , 'No `meilisearch` block found in your model.' if ms_index_settings . nil?
491491
492492 @ms_indexes ||= { true => { } , false => { } }
493493
@@ -506,7 +506,7 @@ def update_settings_if_changed(index, options, user_configuration)
506506
507507 config = user_configuration . except ( :attributes_to_highlight , :attributes_to_crop , :crop_length )
508508
509- if !skip_checking_settings? ( options ) && meilisearch_settings_changed ?( server_state , config )
509+ if !skip_checking_settings? ( options ) && ms_index_settings_changed ?( server_state , config )
510510 index . update_settings ( user_configuration )
511511 end
512512 end
@@ -520,12 +520,12 @@ def ms_checking_disabled?(options)
520520 end
521521
522522 def ms_configurations
523- raise ArgumentError , 'No `meilisearch` block found in your model.' if meilisearch_settings . nil?
523+ raise ArgumentError , 'No `meilisearch` block found in your model.' if ms_index_settings . nil?
524524
525525 if @configurations . nil?
526526 @configurations = { }
527- @configurations [ meilisearch_options ] = meilisearch_settings
528- meilisearch_settings . additional_indexes . each do |k , v |
527+ @configurations [ meilisearch_options ] = ms_index_settings
528+ ms_index_settings . additional_indexes . each do |k , v |
529529 @configurations [ k ] = v
530530
531531 next unless v . additional_indexes . any?
@@ -551,7 +551,7 @@ def ms_pk(options = nil)
551551 options [ :primary_key ] || MeiliSearch ::Rails ::IndexSettings ::DEFAULT_PRIMARY_KEY
552552 end
553553
554- def meilisearch_settings_changed ?( server_state , user_configuration )
554+ def ms_index_settings_changed ?( server_state , user_configuration )
555555 return true if server_state . nil?
556556
557557 user_configuration . transform_keys! { |key | key . to_s . camelize ( :lower ) }
@@ -560,7 +560,7 @@ def meilisearch_settings_changed?(server_state, user_configuration)
560560 server = server_state [ key ]
561561
562562 if user . is_a? ( Hash ) && server . is_a? ( Hash )
563- meilisearch_settings_changed ?( server , user )
563+ ms_index_settings_changed ?( server , user )
564564 elsif user . is_a? ( Array ) && server . is_a? ( Array )
565565 user . map ( &:to_s ) . sort! != server . map ( &:to_s ) . sort!
566566 else
0 commit comments