Commit 2f6a334d7759c7cb09a254eaee469e6a50ab54de
1 parent
643884a9
Exists in
theme-brasil-digital-from-staging
and in
4 other branches
api: paginate article search
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
lib/noosfero/api/v1/search.rb
@@ -5,6 +5,7 @@ module Noosfero | @@ -5,6 +5,7 @@ module Noosfero | ||
5 | 5 | ||
6 | resource :search do | 6 | resource :search do |
7 | resource :article do | 7 | resource :article do |
8 | + paginate per_page: 20, max_per_page: 200 | ||
8 | get do | 9 | get do |
9 | # Security checks | 10 | # Security checks |
10 | sanitize_params_hash(params) | 11 | sanitize_params_hash(params) |
@@ -30,7 +31,7 @@ module Noosfero | @@ -30,7 +31,7 @@ module Noosfero | ||
30 | 31 | ||
31 | articles = search_result[:results] | 32 | articles = search_result[:results] |
32 | 33 | ||
33 | - result = present_articles(articles) | 34 | + result = present_articles_paginated(articles) |
34 | 35 | ||
35 | result | 36 | result |
36 | end | 37 | end |