Skip to content

Commit

Permalink
Merge pull request #741 from toptal/handle-string-type-deprecation
Browse files Browse the repository at this point in the history
Document string vs keyword/text for ES6
  • Loading branch information
mrzasa authored Feb 1, 2021
2 parents 1c7e7ba + 6d8e89b commit 868b363
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Or install it yourself as:

### Ruby

Chewy is compatible with MRI 2.5-3.0¹.
Chewy is compatible with MRI 2.5-3.0¹.

> ¹ Ruby 3 is only supported with Rails 6.1
Expand Down Expand Up @@ -197,7 +197,7 @@ Chewy.settings = {
field :badges, value: ->(user) { user.badges.map(&:name) } # passing array values to index
field :projects do # the same block syntax for multi_field, if `:type` is specified
field :title
field :description # default data type is `string`
field :description # default data type is `text`
# additional top-level objects passed to value proc:
field :categories, value: ->(project, user) { project.categories.map(&:name) if user.active? }
end
Expand Down
2 changes: 1 addition & 1 deletion lib/chewy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Config
# Default options for root of Chewy type. Allows to set default options
# for type mappings like `_all`.
:default_root_options,
# Default field type for any field in any Chewy type. Defaults to 'string'.
# Default field type for any field in any Chewy type. Defaults to 'text'.
:default_field_type

attr_reader :transport_logger, :transport_tracer,
Expand Down
8 changes: 8 additions & 0 deletions migration_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Chewy 5 to 6

It's a documentation stub, it'll be developed during the process of preparing chewy for ES6 compatibility.

When you want to prepare your application for chewy6:

* replace field with `{ type: 'string', index: 'not_analyzed'}` by `{type: 'keyword'}`
* replace field with `{ type: 'string', index: 'analyzed'}` by `{type: 'text'}`

0 comments on commit 868b363

Please sign in to comment.