Skip to content
Snippets Groups Projects
Commit c9e426bd authored by Clarissa's avatar Clarissa
Browse files

#247: search return the number requested per_page and which page

parent b22d7ffb
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,9 @@ module SearchService ...@@ -45,7 +45,9 @@ module SearchService
}, },
filter: mount_filter filter: mount_filter
} }
} },
size: @search.results_per_page,
from: ((@search.page.to_i) * (@search.results_per_page.to_i)).to_s
} }
return match_all_query if @search.query == '*' return match_all_query if @search.query == '*'
...@@ -58,7 +60,11 @@ module SearchService ...@@ -58,7 +60,11 @@ module SearchService
} }, } },
functions: [{ script_score: { script: { lang: 'groovy', file: 'calculate_score' } } }] functions: [{ script_score: { script: { lang: 'groovy', file: 'calculate_score' } } }]
} }
} },
# https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html
# Comeca pagina 0
size: @search.results_per_page,
from: ((@search.page.to_i) * (@search.results_per_page.to_i)).to_s
} }
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment