Correctly set the "acceptTags" when we filter by tags.

In case of "other" filter, we were setting the filter with
`filter.rejectTags(tags)` and `filter.acceptTags(tags)` in the same time.
Which obviously return 0 results.

We must call `filter.acceptTags(tags)` only if we use a specific category,
not all the time (including with "other" category).

Fix #786
This commit is contained in:
Matthieu Gautier 2022-02-14 16:17:34 +01:00
parent 8551bcffde
commit cb63bb2d01

View File

@ -396,6 +396,7 @@ QStringList ContentManager::getBookIds()
std::vector<std::string> tags;
if (m_categoryFilter != "all" && m_categoryFilter != "other") {
tags.push_back("_category:"+m_categoryFilter.toStdString());
filter.acceptTags(tags);
}
if (m_categoryFilter == "other") {
for (auto& category: S_CATEGORIES) {
@ -416,7 +417,6 @@ QStringList ContentManager::getBookIds()
}
}
filter.acceptTags(tags);
filter.query(m_searchQuery.toStdString());
if (m_currentLanguage != "*")
filter.lang(m_currentLanguage.toStdString());