about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-12 14:33:21 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-12 14:36:10 +0100
commit09218d4c0152013750dd1c127d3c8267dc45f880 (patch)
tree7cd9975b84a28de92403c80f483d08e471b10155 /app/controllers/api
parentcd765f26a9610e160ffd347637fca40d7b80164e (diff)
Use full-text search for autosuggestions
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/accounts_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index 5cc0817f6..9b02c9981 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -2,7 +2,7 @@ class Api::V1::AccountsController < ApiController
   before_action -> { doorkeeper_authorize! :read }, except: [:follow, :unfollow, :block, :unblock]
   before_action -> { doorkeeper_authorize! :follow }, only: [:follow, :unfollow, :block, :unblock]
   before_action :require_user!, except: [:show, :following, :followers, :statuses]
-  before_action :set_account, except: [:verify_credentials, :suggestions]
+  before_action :set_account, except: [:verify_credentials, :suggestions, :search]
 
   respond_to :json
 
@@ -91,6 +91,11 @@ class Api::V1::AccountsController < ApiController
     @blocking    = Account.blocking_map(ids, current_user.account_id)
   end
 
+  def search
+    @accounts = SearchService.new.call(params[:q], params[:resolve] == 'true')
+    render action: :index
+  end
+
   private
 
   def set_account