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/accounts_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/accounts_index.rb')
-rw-r--r-- | app/chewy/accounts_index.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/app/chewy/accounts_index.rb b/app/chewy/accounts_index.rb index b814e009e..6f9ea76e9 100644 --- a/app/chewy/accounts_index.rb +++ b/app/chewy/accounts_index.rb @@ -23,21 +23,21 @@ class AccountsIndex < Chewy::Index }, } - define_type ::Account.searchable.includes(:account_stat), delete_if: ->(account) { account.destroyed? || !account.searchable? } do - root date_detection: false do - field :id, type: 'long' + index_scope ::Account.searchable.includes(:account_stat), delete_if: ->(account) { account.destroyed? || !account.searchable? } - field :display_name, type: 'text', analyzer: 'content' do - field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content' - end + root date_detection: false do + field :id, type: 'long' - field :acct, type: 'text', analyzer: 'content', value: ->(account) { [account.username, account.domain].compact.join('@') } do - field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content' - end + field :display_name, type: 'text', analyzer: 'content' do + field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content' + end - field :following_count, type: 'long', value: ->(account) { account.following.local.count } - field :followers_count, type: 'long', value: ->(account) { account.followers.local.count } - field :last_status_at, type: 'date', value: ->(account) { account.last_status_at || account.created_at } + field :acct, type: 'text', analyzer: 'content', value: ->(account) { [account.username, account.domain].compact.join('@') } do + field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'content' end + + field :following_count, type: 'long', value: ->(account) { account.following.local.count } + field :followers_count, type: 'long', value: ->(account) { account.followers.local.count } + field :last_status_at, type: 'date', value: ->(account) { account.last_status_at || account.created_at } end end |