This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-03-21 18:32:27 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-07 11:09:25 -07:00
|
|
|
class Api::V1::SearchController < Api::BaseController
|
2017-05-30 18:11:54 -07:00
|
|
|
RESULTS_LIMIT = 5
|
|
|
|
|
2017-03-21 18:32:27 -07:00
|
|
|
respond_to :json
|
|
|
|
|
|
|
|
def index
|
2017-05-30 18:11:54 -07:00
|
|
|
@search = OpenStruct.new(search_results)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def search_results
|
|
|
|
SearchService.new.call(
|
|
|
|
params[:q],
|
|
|
|
RESULTS_LIMIT,
|
|
|
|
resolving_search?,
|
|
|
|
current_account
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def resolving_search?
|
|
|
|
params[:resolve] == 'true'
|
2017-03-21 18:32:27 -07:00
|
|
|
end
|
|
|
|
end
|