diff options
author | Takeshi Umeda <noel.yoshiba@gmail.com> | 2021-11-19 06:02:08 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 22:02:08 +0100 |
commit | 3419d3ec84c3aa4f450265642e0a85dcdd3c36d0 (patch) | |
tree | dfd530fcfaed29a5421138087ef3a240d3c45a3c /app/chewy/tags_index.rb | |
parent | 2b6a25c609e2d1814e5dd586e9f40868d944c8bc (diff) |
Bump chewy from 5.2.0 to 7.2.3 (supports Elasticsearch 7.x) (#16915)
* Bump chewy from 5.2.0 to 7.2.2 * fix style (codeclimate) * fix style * fix style * Bump chewy from 7.2.2 to 7.2.3
Diffstat (limited to 'app/chewy/tags_index.rb')
-rw-r--r-- | app/chewy/tags_index.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/chewy/tags_index.rb b/app/chewy/tags_index.rb index 300fc128f..f811a8d67 100644 --- a/app/chewy/tags_index.rb +++ b/app/chewy/tags_index.rb @@ -23,15 +23,15 @@ class TagsIndex < Chewy::Index }, } - define_type ::Tag.listable, delete_if: ->(tag) { tag.destroyed? || !tag.listable? } do - root date_detection: false do - field :name, type: 'text', analyzer: 'content' do - field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content' - end + index_scope ::Tag.listable, delete_if: ->(tag) { tag.destroyed? || !tag.listable? } - field :reviewed, type: 'boolean', value: ->(tag) { tag.reviewed? } - field :usage, type: 'long', value: ->(tag) { tag.history.reduce(0) { |total, day| total + day[:accounts].to_i } } - field :last_status_at, type: 'date', value: ->(tag) { tag.last_status_at || tag.created_at } + root date_detection: false do + field :name, type: 'text', analyzer: 'content' do + field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content' end + + field :reviewed, type: 'boolean', value: ->(tag) { tag.reviewed? } + field :usage, type: 'long', value: ->(tag) { tag.history.reduce(0) { |total, day| total + day[:accounts].to_i } } + field :last_status_at, type: 'date', value: ->(tag) { tag.last_status_at || tag.created_at } end end |