File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -157,9 +157,6 @@ def posts_query(limit)
157157 . order ( "TS_RANK_CD(post_search_data.search_data, #{ ts_query } ) DESC" )
158158 . order ( "topics.bumped_at DESC" )
159159
160-
161-
162-
163160 if secure_category_ids . present?
164161 posts = posts . where ( "(categories.id IS NULL) OR (NOT categories.secure) OR (categories.id IN (?))" , secure_category_ids )
165162 else
@@ -181,7 +178,15 @@ def ts_query
181178 end
182179
183180 def topic_search
184- posts_query ( @limit ) . where ( post_number : 1 ) . each do |p |
181+
182+ # If we have a user filter, search all posts by default with a higher limit
183+ posts = if @search_context . present? and @search_context . is_a? ( User )
184+ posts_query ( @limit * 3 )
185+ else
186+ posts_query ( @limit ) . where ( post_number : 1 )
187+ end
188+
189+ posts . each do |p |
185190 @results . add_result ( SearchResult . from_post ( p ) )
186191 end
187192 end
You can’t perform that action at this time.
0 commit comments