|
|
@ -1,6 +1,8 @@
|
|
|
|
# frozen_string_literal: true
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
|
|
class AccountsIndex < Chewy::Index
|
|
|
|
class AccountsIndex < Chewy::Index
|
|
|
|
|
|
|
|
include DatetimeClampingConcern
|
|
|
|
|
|
|
|
|
|
|
|
settings index: index_preset(refresh_interval: '30s'), analysis: {
|
|
|
|
settings index: index_preset(refresh_interval: '30s'), analysis: {
|
|
|
|
filter: {
|
|
|
|
filter: {
|
|
|
|
english_stop: {
|
|
|
|
english_stop: {
|
|
|
@ -60,7 +62,7 @@ class AccountsIndex < Chewy::Index
|
|
|
|
field(:following_count, type: 'long')
|
|
|
|
field(:following_count, type: 'long')
|
|
|
|
field(:followers_count, type: 'long')
|
|
|
|
field(:followers_count, type: 'long')
|
|
|
|
field(:properties, type: 'keyword', value: ->(account) { account.searchable_properties })
|
|
|
|
field(:properties, type: 'keyword', value: ->(account) { account.searchable_properties })
|
|
|
|
field(:last_status_at, type: 'date', value: ->(account) { account.last_status_at || account.created_at })
|
|
|
|
field(:last_status_at, type: 'date', value: ->(account) { clamp_date(account.last_status_at || account.created_at) })
|
|
|
|
field(:display_name, type: 'text', analyzer: 'verbatim') { field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'verbatim' }
|
|
|
|
field(:display_name, type: 'text', analyzer: 'verbatim') { field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'verbatim' }
|
|
|
|
field(:username, type: 'text', analyzer: 'verbatim', value: ->(account) { [account.username, account.domain].compact.join('@') }) { field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'verbatim' }
|
|
|
|
field(:username, type: 'text', analyzer: 'verbatim', value: ->(account) { [account.username, account.domain].compact.join('@') }) { field :edge_ngram, type: 'text', analyzer: 'edge_ngram', search_analyzer: 'verbatim' }
|
|
|
|
field(:text, type: 'text', analyzer: 'verbatim', value: ->(account) { account.searchable_text }) { field :stemmed, type: 'text', analyzer: 'natural' }
|
|
|
|
field(:text, type: 'text', analyzer: 'verbatim', value: ->(account) { account.searchable_text }) { field :stemmed, type: 'text', analyzer: 'natural' }
|
|
|
|