0
0
Fork 0

Use full-text search for autosuggestions

This commit is contained in:
Eugen Rochko 2016-11-12 14:33:21 +01:00
parent cd765f26a9
commit 09218d4c01
14 changed files with 153 additions and 39 deletions

View file

@ -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