add itemsPerPage to search api

v1.18.x
Baris Usakli 6 years ago
parent 3e2dffa6d0
commit 2ee743d65c

@ -50,6 +50,7 @@ searchController.search = function (req, res, next) {
sortBy: req.query.sortBy || meta.config.searchDefaultSortBy || '',
sortDirection: req.query.sortDirection,
page: page,
itemsPerPage: req.query.itemsPerPage,
uid: req.uid,
qs: req.query,
};

@ -116,7 +116,7 @@ function searchInContent(data, callback) {
next(null, Object.assign({
posts: posts,
matchCount: matchCount,
pageCount: Math.max(1, Math.ceil(parseInt(matchCount, 10) / 10)),
pageCount: Math.max(1, Math.ceil(parseInt(matchCount, 10) / itemsPerPage)),
}, metadata));
},
], callback);

Loading…
Cancel
Save