Added groups to search results
This commit is contained in:
@@ -16,6 +16,7 @@ class SearchService < BaseService
|
||||
results[:accounts] = perform_accounts_search! if account_searchable?
|
||||
results[:statuses] = perform_statuses_search! if full_text_searchable?
|
||||
results[:hashtags] = perform_hashtags_search! if hashtag_searchable?
|
||||
results[:groups] = perform_groups_search!
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -32,6 +33,14 @@ class SearchService < BaseService
|
||||
)
|
||||
end
|
||||
|
||||
def perform_groups_search!
|
||||
Group.search_for(
|
||||
@query.gsub(/\A#/, ''),
|
||||
@limit,
|
||||
@offset
|
||||
)
|
||||
end
|
||||
|
||||
def perform_statuses_search!
|
||||
definition = StatusesIndex.filter(term: { searchable_by: @account.id })
|
||||
.query(multi_match: { type: 'most_fields', query: @query, operator: 'and', fields: %w(text text.stemmed) })
|
||||
|
||||
Reference in New Issue
Block a user