}
std::shared_ptr<HistoryItemVector> HistoryService::getHistoryItemsByKeywordsString(
- const std::string& keywordsString, int maxItems)
+ const std::string& keywordsString, const int maxItems,
+ const int minKeywordLength)
{
if (keywordsString.empty())
return std::make_shared<HistoryItemVector>();
boost::algorithm::to_lower(longestKeyword);
// assumption: search starts when longest keyword is at least 3 characters long
- if (longestKeyword.length() < 3) {
+ if (longestKeyword.length() < minKeywordLength) {
return std::make_shared<HistoryItemVector>();
}
m_historyMatchFinder->removeMismatches(historyItems, keywords);
}
- if (historyItems->size() > maxItems) {
- historyItems->erase(historyItems->begin() + maxItems,
- historyItems->end());
+ if (maxItems != -1) {
+ if (historyItems->size() > maxItems) {
+ historyItems->erase(historyItems->begin() + maxItems,
+ historyItems->end());
+ }
}
return historyItems;
}