mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-25 13:19:59 -04:00
Merge pull request #302 from kiwix/adapt_to_new_book_filter
Adapt kiwix-serve to the new api to filter library.
This commit is contained in:
commit
fc5572f495
@ -694,8 +694,7 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
|||||||
opdsDumper.setTitle("All zims");
|
opdsDumper.setTitle("All zims");
|
||||||
uuid = zim::Uuid::generate(host);
|
uuid = zim::Uuid::generate(host);
|
||||||
|
|
||||||
bookIdsToDump = library.listBooksIds(
|
bookIdsToDump = library.filter(kiwix::Filter().valid(true).local(true).remote(true));
|
||||||
kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE);
|
|
||||||
} else if (url == "search") {
|
} else if (url == "search") {
|
||||||
std::string query;
|
std::string query;
|
||||||
std::string language;
|
std::string language;
|
||||||
@ -719,14 +718,11 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
|||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
opdsDumper.setTitle("Search result for " + query);
|
opdsDumper.setTitle("Search result for " + query);
|
||||||
uuid = zim::Uuid::generate();
|
uuid = zim::Uuid::generate();
|
||||||
bookIdsToDump = library.listBooksIds(
|
bookIdsToDump = library.filter(
|
||||||
kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE,
|
kiwix::Filter().valid(true).local(true).remote(true)
|
||||||
kiwix::UNSORTED,
|
.query(query)
|
||||||
query,
|
.lang(language)
|
||||||
language,
|
.acceptTags(tags));
|
||||||
"", // creator
|
|
||||||
"", // publisher
|
|
||||||
tags);
|
|
||||||
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) {
|
||||||
@ -1118,7 +1114,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Instance the readers and searcher and build the corresponding maps */
|
/* Instance the readers and searcher and build the corresponding maps */
|
||||||
vector<string> booksIds = library.listBooksIds(kiwix::LOCAL);
|
vector<string> booksIds = library.filter(kiwix::Filter().local(true));
|
||||||
globalSearcher = new kiwix::Searcher();
|
globalSearcher = new kiwix::Searcher();
|
||||||
globalSearcher->setProtocolPrefix(rootLocation + "/");
|
globalSearcher->setProtocolPrefix(rootLocation + "/");
|
||||||
globalSearcher->setSearchProtocolPrefix(rootLocation + "/" + "search?");
|
globalSearcher->setSearchProtocolPrefix(rootLocation + "/" + "search?");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user