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

Use deep_merge for model_options #1695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cumet04
Copy link

@cumet04 cumet04 commented Oct 5, 2024

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?

@ankane
Copy link
Owner

ankane commented Oct 6, 2024

Hi @cumet04, thanks for the PR! It looks good, but want to wait until 6.0 to merge since it changes the current behavior.

@cumet04
Copy link
Author

cumet04 commented Oct 6, 2024

Thank you for considering this! I'm looking forward to 6.0.

@ankane ankane mentioned this pull request Oct 6, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants