Extend search limits to 140.

70 is a too small limit for the number of results.
Users need at least 100.

As the html rendering will fails with more than 144 results,
explicitly limits the number of search to 140.

Fixes kiwix/kiwix-tools#92
This commit is contained in:
Matthieu Gautier 2017-11-06 12:13:54 +01:00
parent 382655d83c
commit 0e8c8f68c5
1 changed files with 5 additions and 3 deletions

View File

@ -33,6 +33,8 @@
using namespace CTPP;
#endif
#define MAX_SEARCH_LEN 140
namespace kiwix
{
class _Result : public Result
@ -141,9 +143,9 @@ void Searcher::search(std::string& search,
if (resultStart != resultEnd) {
/* Avoid big researches */
this->resultCountPerPage = resultEnd - resultStart;
if (this->resultCountPerPage > 70) {
resultEnd = resultStart + 70;
this->resultCountPerPage = 70;
if (this->resultCountPerPage > MAX_SEARCH_LEN) {
resultEnd = resultStart + MAX_SEARCH_LEN;
this->resultCountPerPage = MAX_SEARCH_LEN;
}
/* Perform the search */