Skip to content

Commit

Permalink
サーバーと同一の変更
Browse files Browse the repository at this point in the history
  • Loading branch information
ttrace committed Jan 24, 2023
1 parent 2bad619 commit d6025aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions app/chewy/statuses_index.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# frozen_string_literal: true

class StatusesIndex < Chewy::Index
include FormattingHelper

settings index: { refresh_interval: '30s' }, analysis: {
class StatusesIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: {
filter: {
english_stop: {
type: 'stop',
Expand All @@ -20,12 +19,13 @@ class StatusesIndex < Chewy::Index
},
analyzer: {
content: {
tokenizer: 'uax_url_email',
tokenizer: 'kuromoji_tokenizer',
char_filter: %w(
icu_normalizer
),
filter: %w(
english_possessive_stemmer
lowercase
asciifolding
cjk_width
english_stop
english_stemmer
),
Expand Down
3 changes: 2 additions & 1 deletion app/lib/search_query_transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def apply(search)
def clause_to_query(clause)
case clause
when TermClause
{ multi_match: { type: 'most_fields', query: clause.term, fields: ['text', 'text.stemmed'] } }
# { multi_match: { type: 'most_fields', query: clause.term, fields: ['text', 'text.stemmed'] } }
{ match: { 'text.stemmed': {query: clause.term} } }
when PhraseClause
{ match_phrase: { text: { query: clause.phrase } } }
else
Expand Down
3 changes: 2 additions & 1 deletion app/services/search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def perform_accounts_search!

def perform_statuses_search!
definition = parsed_query.apply(StatusesIndex.filter(term: { searchable_by: @account.id }))
definition = parsed_query.apply(StatusesIndex).order(id: :desc)

if @options[:account_id].present?
definition = definition.filter(term: { account_id: @options[:account_id] })
Expand Down Expand Up @@ -118,7 +119,7 @@ def relations_map_for_account(account, account_ids, domains)
blocking: Account.blocking_map(account_ids, account.id),
blocked_by: Account.blocked_by_map(account_ids, account.id),
muting: Account.muting_map(account_ids, account.id),
following: Account.following_map(account_ids, account.id),
# following: Account.following_map(account_ids, account.id),
domain_blocking_by_domain: Account.domain_blocking_map_by_domain(domains, account.id),
}
end
Expand Down

0 comments on commit d6025aa

Please sign in to comment.