mirror of https://github.com/kiwix/libkiwix.git
+ take care the nore than maxsuggestions is delivered
This commit is contained in:
parent
2ad238f095
commit
987d6f672f
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue