mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 19:38:53 -04:00
Merge pull request #305 from kiwix/notag-parameter
add notag parameter to the api
This commit is contained in:
commit
79a64d5af3
@ -698,6 +698,7 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
|||||||
std::string query;
|
std::string query;
|
||||||
std::string language;
|
std::string language;
|
||||||
std::vector<std::string> tags;
|
std::vector<std::string> tags;
|
||||||
|
std::vector<std::string> noTags;
|
||||||
size_t count(10);
|
size_t count(10);
|
||||||
size_t startIndex(0);
|
size_t startIndex(0);
|
||||||
try {
|
try {
|
||||||
@ -715,13 +716,18 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
|||||||
try {
|
try {
|
||||||
tags.push_back(request->get_argument("tag"));
|
tags.push_back(request->get_argument("tag"));
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
|
try {
|
||||||
|
noTags = kiwix::split(request->get_argument("notag"), ";");
|
||||||
|
} catch (...) {}
|
||||||
opdsDumper.setTitle("Search result for " + query);
|
opdsDumper.setTitle("Search result for " + query);
|
||||||
uuid = zim::Uuid::generate();
|
uuid = zim::Uuid::generate();
|
||||||
bookIdsToDump = library.filter(
|
bookIdsToDump = library.filter(
|
||||||
kiwix::Filter().valid(true).local(true).remote(true)
|
kiwix::Filter().valid(true).local(true).remote(true)
|
||||||
.query(query)
|
.query(query)
|
||||||
.lang(language)
|
.lang(language)
|
||||||
.acceptTags(tags));
|
.acceptTags(tags)
|
||||||
|
.rejectTags(noTags)
|
||||||
|
);
|
||||||
auto totalResults = bookIdsToDump.size();
|
auto totalResults = bookIdsToDump.size();
|
||||||
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+startIndex);
|
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+startIndex);
|
||||||
if (count>0 && bookIdsToDump.size() > count) {
|
if (count>0 && bookIdsToDump.size() > count) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user