From 09218d4c0152013750dd1c127d3c8267dc45f880 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 12 Nov 2016 14:33:21 +0100 Subject: Use full-text search for autosuggestions --- app/controllers/api/v1/accounts_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/controllers/api/v1') 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 -- cgit