add "notag" parameter to the search api

The notag parameter is filled with all categories from the category list
separated by a ";"
This commit is contained in:
luddens 2019-06-28 12:11:25 +02:00 committed by Matthieu Gautier
parent e8d98f04e2
commit 8a37a83e8f

View File

@ -1,4 +1,5 @@
#include "opdsrequestmanager.h" #include "opdsrequestmanager.h"
#include "kiwixapp.h"
OpdsRequestManager::OpdsRequestManager() OpdsRequestManager::OpdsRequestManager()
: mp_reply(nullptr) : mp_reply(nullptr)
@ -14,9 +15,22 @@ void OpdsRequestManager::doUpdate(const QString& currentLanguage, const QString&
query.addQueryItem("lang", currentLanguage); query.addQueryItem("lang", currentLanguage);
} }
query.addQueryItem("count", QString::number(0)); query.addQueryItem("count", QString::number(0));
if (categoryFilter != "all") { if (categoryFilter != "all" && categoryFilter != "other") {
query.addQueryItem("tag", categoryFilter); query.addQueryItem("tag", categoryFilter);
} }
if (categoryFilter == "other") {
auto allCategories = KiwixApp::instance()->getMainWindow()->getSideContentManager()->getCategoryList();
QStringList excludeTags;
for (auto& category:allCategories) {
if (category != "Other") {
excludeTags += category.toLower();
}
}
query.addQueryItem("notag", excludeTags.join(";"));
}
QUrl url; QUrl url;
url.setScheme("http"); url.setScheme("http");
url.setHost(CATALOG_HOST); url.setHost(CATALOG_HOST);