mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
Add attribute to grouped search results for more available posts.
This commit is contained in:
parent
b534778f46
commit
7b40de5ac4
|
@ -2,7 +2,7 @@ class GroupedSearchResultSerializer < ApplicationSerializer
|
|||
has_many :posts, serializer: SearchPostSerializer
|
||||
has_many :users, serializer: SearchResultUserSerializer
|
||||
has_many :categories, serializer: BasicCategorySerializer
|
||||
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id
|
||||
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id, :more_full_page_results
|
||||
|
||||
def search_log_id
|
||||
object.search_log_id
|
||||
|
|
|
@ -19,7 +19,8 @@ class Search
|
|||
:more_users,
|
||||
:term,
|
||||
:search_context,
|
||||
:include_blurbs
|
||||
:include_blurbs,
|
||||
:more_full_page_results
|
||||
)
|
||||
|
||||
attr_accessor :search_log_id
|
||||
|
@ -50,7 +51,9 @@ class Search
|
|||
def add(object)
|
||||
type = object.class.to_s.downcase.pluralize
|
||||
|
||||
if !@type_filter.present? && send(type).length == Search.per_facet
|
||||
if @type_filter.present? && send(type).length == Search.per_filter
|
||||
@more_full_page_results = true
|
||||
elsif !@type_filter.present? && send(type).length == Search.per_facet
|
||||
instance_variable_set("@more_#{type}".to_sym, true)
|
||||
else
|
||||
(send type) << object
|
||||
|
|
Loading…
Reference in New Issue
Block a user