mirror of
https://github.com/discourse/discourse.git
synced 2026-07-29 15:54:48 -05:00
Add blurb of post to search results via API
This commit is contained in:
+3
-2
@@ -44,6 +44,7 @@ class Search
|
||||
@opts = opts || {}
|
||||
@guardian = @opts[:guardian] || Guardian.new
|
||||
@search_context = @opts[:search_context]
|
||||
@include_blurbs = @opts[:include_blurbs] || false
|
||||
@limit = Search.per_facet * Search.facets.size
|
||||
@results = GroupedSearchResults.new(@opts[:type_filter])
|
||||
|
||||
@@ -101,7 +102,7 @@ class Search
|
||||
extra_posts = posts_query(expected_topics * Search.burst_factor)
|
||||
extra_posts = extra_posts.where("posts.topic_id NOT in (?)", @results.topic_ids) if @results.topic_ids.present?
|
||||
extra_posts.each do |p|
|
||||
@results.add_result(SearchResult.from_post(p, @search_context, @term))
|
||||
@results.add_result(SearchResult.from_post(p, @search_context, @term, @include_blurbs))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -213,7 +214,7 @@ class Search
|
||||
|
||||
|
||||
posts.each do |p|
|
||||
@results.add_result(SearchResult.from_post(p, @search_context, @term))
|
||||
@results.add_result(SearchResult.from_post(p, @search_context, @term, @include_blurbs))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user