about summary refs log tree commit diff
path: root/app/services/account_search_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/account_search_service.rb')
-rw-r--r--app/services/account_search_service.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb
index 4dcae20eb..35b2e05f5 100644
--- a/app/services/account_search_service.rb
+++ b/app/services/account_search_service.rb
@@ -3,6 +3,9 @@
 class AccountSearchService < BaseService
   attr_reader :query, :limit, :offset, :options, :account
 
+  # Min. number of characters to look for non-exact matches
+  MIN_QUERY_LENGTH = 5
+
   def call(query, account = nil, options = {})
     @acct_hint = query&.start_with?('@')
     @query     = query&.strip&.gsub(/\A@/, '')
@@ -135,6 +138,8 @@ class AccountSearchService < BaseService
   end
 
   def limit_for_non_exact_results
+    return 0 if @account.nil? && query.size < MIN_QUERY_LENGTH
+
     if exact_match?
       limit - 1
     else