From 0e8c8f68c54f4fbaee9fc2002e969ae29bfc18ab Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 6 Nov 2017 12:13:54 +0100 Subject: [PATCH] Extend search limits to 140. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/searcher.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/searcher.cpp b/src/searcher.cpp index 1b1b0f004..8c5a27ad8 100644 --- a/src/searcher.cpp +++ b/src/searcher.cpp @@ -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 */