From afded319d2558369a025b1f3335cebacc9819881 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 12 Nov 2016 14:49:28 +0100 Subject: Add limit to search results --- app/controllers/api/v1/accounts_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 9b02c9981..9573326ef 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -92,7 +92,8 @@ class Api::V1::AccountsController < ApiController end def search - @accounts = SearchService.new.call(params[:q], params[:resolve] == 'true') + limit = params[:limit] ? [DEFAULT_ACCOUNTS_LIMIT, params[:limit].to_i].min : DEFAULT_ACCOUNTS_LIMIT + @accounts = SearchService.new.call(params[:q], limit, params[:resolve] == 'true') render action: :index end -- cgit