mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-23 03:58:56 -04:00
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:
parent
e8d98f04e2
commit
8a37a83e8f
@ -1,4 +1,5 @@
|
||||
#include "opdsrequestmanager.h"
|
||||
#include "kiwixapp.h"
|
||||
|
||||
OpdsRequestManager::OpdsRequestManager()
|
||||
: mp_reply(nullptr)
|
||||
@ -14,16 +15,29 @@ void OpdsRequestManager::doUpdate(const QString& currentLanguage, const QString&
|
||||
query.addQueryItem("lang", currentLanguage);
|
||||
}
|
||||
query.addQueryItem("count", QString::number(0));
|
||||
if (categoryFilter != "all") {
|
||||
if (categoryFilter != "all" && categoryFilter != "other") {
|
||||
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;
|
||||
url.setScheme("http");
|
||||
url.setHost(CATALOG_HOST);
|
||||
url.setPort(CATALOG_PORT);
|
||||
url.setPath("/catalog/search");
|
||||
url.setQuery(query);
|
||||
|
||||
|
||||
qInfo() << "Downloading" << url.toString(QUrl::FullyEncoded);
|
||||
|
||||
QNetworkRequest request(url);
|
||||
@ -42,4 +56,4 @@ void OpdsRequestManager::receiveContent()
|
||||
}
|
||||
mp_reply->deleteLater();
|
||||
mp_reply = nullptr;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user