Make opensearch start parameter 1 indexed.

This commit is contained in:
Matthieu Gautier
2022-06-03 15:05:37 +02:00
parent 8100977cda
commit 7cb98f7f4e
3 changed files with 68 additions and 15 deletions

View File

@ -185,8 +185,8 @@ std::string SearchRenderer::renderTemplate(const std::string& tmpl_str)
results.set("items", items);
results.set("count", kiwix::beautifyInteger(estimatedResultCount));
results.set("hasResults", estimatedResultCount != 0);
results.set("start", kiwix::beautifyInteger(resultStart+1));
results.set("end", kiwix::beautifyInteger(min(resultStart+pageLength, estimatedResultCount)));
results.set("start", kiwix::beautifyInteger(resultStart));
results.set("end", kiwix::beautifyInteger(min(resultStart+pageLength-1, estimatedResultCount)));
// pagination
auto pagination = buildPagination(