Skip to content

Commit

Permalink
Remove not analyzed (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil Nurgaliev authored and Ivan Rabotyaga committed Feb 11, 2021
1 parent 1bbc712 commit 22d336b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ To define a multi field you have to specify any type except for `object` or `nes
```ruby
field :full_name, type: 'text', value: ->{ full_name.strip } do
field :ordered, analyzer: 'ordered'
field :untouched, index: 'not_analyzed'
field :untouched, type: 'keyword'
end
```

Expand Down
6 changes: 0 additions & 6 deletions lib/chewy/fields/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ def mappings_hash
mapping.reverse_merge!(options)
mapping.reverse_merge!(type: (children.present? ? 'object' : Chewy.default_field_type))

# This is done to support ES2 journaling and will be removed soon
if mapping[:type] == 'keyword' && Chewy::Runtime.version < '5.0'
mapping[:type] = 'string'
mapping[:index] = 'not_analyzed'
end

{name => mapping}
end

Expand Down
4 changes: 2 additions & 2 deletions spec/chewy/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def self.by_index(index)
filter { match name: "Name#{index}" }
end

field :name, **KEYWORD_FIELD
field :name, type: 'keyword'
field :rating, type: :integer
end

define_type Country do
field :name, **KEYWORD_FIELD
field :name, type: 'keyword'
field :rating, type: :integer
end
end
Expand Down
7 changes: 0 additions & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,8 @@
}
}

Chewy.default_field_type = 'string' if Chewy::Runtime.version < '5.0'
# Chewy.transport_logger = Logger.new(STDERR)

KEYWORD_FIELD = if Chewy::Runtime.version < '5.0'
{type: 'string', index: 'not_analyzed'}
else
{type: 'keyword'}
end

RSpec.configure do |config|
config.mock_with :rspec
config.order = :random
Expand Down

0 comments on commit 22d336b

Please sign in to comment.