about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/status.rb4
-rw-r--r--app/services/search_service.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 4210a1815..0be747b00 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -335,7 +335,7 @@ class Status < ApplicationRecord
   after_create :process_bangtags, if: :local?
 
   class << self
-    def search_for(term, limit = 33, account = nil)
+    def search_for(term, account = nil, limit = 33, offset = 0)
       return none if account.nil?
       if term.start_with?('me:')
         term = term.split(nil, 2)[1]
@@ -349,7 +349,7 @@ class Status < ApplicationRecord
       return none if term.blank?
       pattern = sanitize_sql_like(term)
       pattern = "#{pattern}"
-      query = query.without_reblogs.where("tsv @@ plainto_tsquery('english', ?)", pattern).limit(limit)
+      query = query.without_reblogs.where("tsv @@ plainto_tsquery('english', ?)", pattern).offset(offset).limit(limit)
       apply_timeline_filters(query, account, true)
     end
 
diff --git a/app/services/search_service.rb b/app/services/search_service.rb
index dda741bc4..ff6cc2197 100644
--- a/app/services/search_service.rb
+++ b/app/services/search_service.rb
@@ -23,7 +23,7 @@ class SearchService < BaseService
   private
 
   def search_for
-    results = Status.search_for(@query.gsub(/\A#/, ''), @limit, @account)
+    results = Status.search_for(@query.gsub(/\A#/, ''), @account, @limit, @offset)
     return results if results.empty?
     account_ids         = results.pluck(:account_id)
     account_domains     = results.map(&:account_domain)
@@ -35,7 +35,7 @@ class SearchService < BaseService
     AccountSearchService.new.call(
       @query,
       @account,
-      limit: [@limit, 15].min,
+      limit: [@limit, 12].min,
       resolve: @resolve,
       offset: @offset
     )