+ take care the nore than maxsuggestions is delivered

This commit is contained in:
kelson42 2013-11-10 17:42:52 +01:00
parent 2ad238f095
commit 987d6f672f
1 changed files with 6 additions and 2 deletions

View File

@ -453,9 +453,13 @@ namespace kiwix {
std::vector<std::string>::iterator suggestionItr; std::vector<std::string>::iterator suggestionItr;
int result; int result;
/* Reset the suggestions */ /* Reset the suggestions otherwise check if the suggestions number is less than the suggestionsCount */
if (reset) { if (reset) {
this->suggestions.clear(); this->suggestions.clear();
} else {
if (this->suggestions.size() > suggestionsCount) {
return false;
}
} }
if (prefix.size()) { if (prefix.size()) {
@ -467,7 +471,7 @@ namespace kiwix {
if (this->suggestions.size() == 0) { if (this->suggestions.size() == 0) {
this->suggestions.push_back(articleItr->getTitle()); this->suggestions.push_back(articleItr->getTitle());
} else { } else if (this->suggestions.size() < suggestionsCount) {
for (suggestionItr = this->suggestions.begin() ; for (suggestionItr = this->suggestions.begin() ;
suggestionItr != this->suggestions.end(); suggestionItr != this->suggestions.end();
++suggestionItr) { ++suggestionItr) {