|
@@ -57,7 +57,7 @@ end
|
57
|
57
|
def search_threads(q, username, from_date, to_date, sort, offset, exact_match)
|
58
|
58
|
sort = Sequel.desc(sort == 'post' ? :last_post_created_at : :created_at)
|
59
|
59
|
query = VLV::Thread
|
60
|
|
- .select(Sequel.lit('threads.*, count(*) OVER() AS full_count'))
|
|
60
|
+ .select(Sequel.lit('threads.*'))
|
61
|
61
|
.where(Sequel.lit("(LOWER(threads.creator) = LOWER(?) OR ? = '')", username, username))
|
62
|
62
|
.where(Sequel.lit("created_at >= ? OR ? IS NULL", from_date, from_date))
|
63
|
63
|
.where(Sequel.lit("created_at >= ? OR ? IS NULL", to_date, to_date))
|
|
@@ -74,7 +74,7 @@ end
|
74
|
74
|
|
75
|
75
|
def search_posts(q, username, from_date, to_date, offset, exact_match)
|
76
|
76
|
query = VLV::Post
|
77
|
|
- .select(Sequel.lit('posts.*, threads.title as thread_title, threads.remote_id as remote_thread_id, count(*) OVER() AS full_count'))
|
|
77
|
+ .select(Sequel.lit('posts.*, threads.title as thread_title, threads.remote_id as remote_thread_id'))
|
78
|
78
|
.join(Sequel.lit('threads on posts.thread_id = threads.id'))
|
79
|
79
|
.where(Sequel.lit("(LOWER(posts.creator) = LOWER(?) OR (? = ''))", username, username))
|
80
|
80
|
.where(Sequel.lit("posts.created_at >= ? OR ? IS NULL", from_date, from_date))
|