searchkick icon indicating copy to clipboard operation
searchkick copied to clipboard

Use deep_merge for `model_options`

Open cumet04 opened this issue 4 months ago • 2 comments

This PR adds support for nested parameters to model_options. For example,

Searchkick.model_options = {
  settings: {
    number_of_shards: 1,
    number_of_replicas: 0,
  },
}
class Product < ApplicationRecord
  searchkick settings: {
    analysis: {
      tokenizer: {
        kuromoji_with_dictionary: {...},
      },
      analyzer: { ... },
    },
  }
end

with code above, number_of_shards/replicas are ignored previously, but these are considered in this PR. I guess this behaviour is expected because similar feature client_options is deep_merged.

Note: I haven't written any tests for this PR since there aren't any existing tests for model_options or client_options. Should I add some tests?

cumet04 avatar Oct 05 '24 08:10 cumet04