From 15c6252db4864eca5999548ee9f188e3e593a141 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 7 Mar 2019 17:22:16 +0100 Subject: [PATCH] Allow to search the catalog by tags. This way a client may filter the catalog by category. --- src/server/kiwix-serve.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 49f4636..95a5e62 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -698,6 +698,7 @@ static struct MHD_Response* handle_catalog(RequestContext* request) } else if (url == "search") { std::string query; std::string language; + std::vector tags; size_t count(10); size_t startIndex(0); try { @@ -712,13 +713,19 @@ static struct MHD_Response* handle_catalog(RequestContext* request) try { startIndex = stoul(request->get_argument("start")); } catch (...) {} + try { + tags.push_back(request->get_argument("tag")); + } catch (...) {} opdsDumper.setTitle("Search result for " + query); uuid = zim::Uuid::generate(); bookIdsToDump = library.listBooksIds( kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE, kiwix::UNSORTED, query, - language); + language, + "", // creator + "", // publisher + tags); auto totalResults = bookIdsToDump.size(); bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+startIndex); if (count>0 && bookIdsToDump.size() > count) {