闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
408 B

  1. # frozen_string_literal: true
  2. class Api::V1::SearchController < ApiController
  3. RESULTS_LIMIT = 5
  4. respond_to :json
  5. def index
  6. @search = OpenStruct.new(search_results)
  7. end
  8. private
  9. def search_results
  10. SearchService.new.call(
  11. params[:q],
  12. RESULTS_LIMIT,
  13. resolving_search?,
  14. current_account
  15. )
  16. end
  17. def resolving_search?
  18. params[:resolve] == 'true'
  19. end
  20. end