mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: anonymous had <a> items for pin/unpin
FEATURE: display category in search results FEATURE: display topic state (locked/pinned/etc) in search results UI cleanup for search results, clearing floats and so on.
This commit is contained in:
@ -300,10 +300,13 @@ class Search
|
||||
def aggregate_search
|
||||
|
||||
post_sql = posts_query(@limit, aggregate_search: true)
|
||||
.select('topics.id', 'min(post_number) post_number, row_number() OVER() row_number')
|
||||
.select('topics.id', 'min(post_number) post_number')
|
||||
.group('topics.id')
|
||||
.to_sql
|
||||
|
||||
# double wrapping so we get correct row numbers
|
||||
post_sql = "SELECT *, row_number() over() row_number FROM (#{post_sql}) xxx"
|
||||
|
||||
posts = Post.includes(:topic => :category)
|
||||
.joins("JOIN (#{post_sql}) x ON x.id = posts.topic_id AND x.post_number = posts.post_number")
|
||||
.order('row_number')
|
||||
|
Reference in New Issue
Block a user