* Change: #532 ElasticSearch設定の外出し * バージョンチェック * 起動時にエラー
This commit is contained in:
parent
8e7c66522e
commit
a8fbcb3fb6
9 changed files with 508 additions and 269 deletions
|
@ -3,81 +3,9 @@
|
|||
class PublicStatusesIndex < Chewy::Index
|
||||
include DatetimeClampingConcern
|
||||
|
||||
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: {
|
||||
filter: {
|
||||
english_stop: {
|
||||
type: 'stop',
|
||||
stopwords: '_english_',
|
||||
},
|
||||
|
||||
english_stemmer: {
|
||||
type: 'stemmer',
|
||||
language: 'english',
|
||||
},
|
||||
|
||||
english_possessive_stemmer: {
|
||||
type: 'stemmer',
|
||||
language: 'possessive_english',
|
||||
},
|
||||
|
||||
my_posfilter: {
|
||||
type: 'sudachi_part_of_speech',
|
||||
stoptags: [
|
||||
'助詞',
|
||||
'助動詞',
|
||||
'補助記号,句点',
|
||||
'補助記号,読点',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
analyzer: {
|
||||
content: {
|
||||
tokenizer: 'uax_url_email',
|
||||
filter: %w(
|
||||
english_possessive_stemmer
|
||||
lowercase
|
||||
asciifolding
|
||||
cjk_width
|
||||
english_stop
|
||||
english_stemmer
|
||||
),
|
||||
},
|
||||
|
||||
hashtag: {
|
||||
tokenizer: 'keyword',
|
||||
filter: %w(
|
||||
word_delimiter_graph
|
||||
lowercase
|
||||
asciifolding
|
||||
cjk_width
|
||||
),
|
||||
},
|
||||
|
||||
sudachi_analyzer: {
|
||||
tokenizer: 'sudachi_tokenizer',
|
||||
type: 'custom',
|
||||
filter: %w(
|
||||
english_possessive_stemmer
|
||||
lowercase
|
||||
asciifolding
|
||||
cjk_width
|
||||
english_stop
|
||||
english_stemmer
|
||||
my_posfilter
|
||||
sudachi_normalizedform
|
||||
),
|
||||
},
|
||||
},
|
||||
tokenizer: {
|
||||
sudachi_tokenizer: {
|
||||
resources_path: '/etc/elasticsearch/sudachi',
|
||||
split_mode: 'A',
|
||||
type: 'sudachi_tokenizer',
|
||||
discard_punctuation: 'true',
|
||||
},
|
||||
},
|
||||
}
|
||||
# ElasticSearch config is moved to "/config/elasticsearch.default.yml".
|
||||
# Edit it when original Mastodon changed ElasticSearch config.
|
||||
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: ChewyConfig.instance.public_statuses
|
||||
|
||||
index_scope ::Status.unscoped
|
||||
.kept
|
||||
|
@ -87,8 +15,8 @@ class PublicStatusesIndex < Chewy::Index
|
|||
root date_detection: false do
|
||||
field(:id, type: 'long')
|
||||
field(:account_id, type: 'long')
|
||||
field(:text, type: 'text', analyzer: 'sudachi_analyzer', value: ->(status) { status.searchable_text }) { field(:stemmed, type: 'text', analyzer: 'content') }
|
||||
field(:tags, type: 'text', analyzer: 'hashtag', value: ->(status) { status.tags.map(&:display_name) })
|
||||
field(:text, type: 'text', analyzer: ChewyConfig.instance.public_statuses_analyzers.dig('text', 'analyzer'), value: ->(status) { status.searchable_text }) { field(:stemmed, type: 'text', analyzer: ChewyConfig.instance.public_statuses_analyzers.dig('text', 'stemmed', 'analyzer')) }
|
||||
field(:tags, type: 'text', analyzer: ChewyConfig.instance.public_statuses_analyzers.dig('tags', 'analyzer'), value: ->(status) { status.tags.map(&:display_name) })
|
||||
field(:language, type: 'keyword')
|
||||
field(:domain, type: 'keyword', value: ->(status) { status.account.domain || '' })
|
||||
field(:properties, type: 'keyword', value: ->(status) { status.searchable_properties })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue