mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-24 12:30:22 -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");
|
||||
uuid = zim::Uuid::generate(host);
|
||||
|
||||
bookIdsToDump = library.listBooksIds(
|
||||
kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE);
|
||||
bookIdsToDump = library.filter(kiwix::Filter().valid(true).local(true).remote(true));
|
||||
} else if (url == "search") {
|
||||
std::string query;
|
||||
std::string language;
|
||||
@ -719,14 +718,11 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
||||
} catch (...) {}
|
||||
opdsDumper.setTitle("Search result for " + query);
|
||||
uuid = zim::Uuid::generate();
|
||||
bookIdsToDump = library.listBooksIds(
|
||||
kiwix::VALID|kiwix::LOCAL|kiwix::REMOTE,
|
||||
kiwix::UNSORTED,
|
||||
query,
|
||||
language,
|
||||
"", // creator
|
||||
"", // publisher
|
||||
tags);
|
||||
bookIdsToDump = library.filter(
|
||||
kiwix::Filter().valid(true).local(true).remote(true)
|
||||
.query(query)
|
||||
.lang(language)
|
||||
.acceptTags(tags));
|
||||
auto totalResults = bookIdsToDump.size();
|
||||
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+startIndex);
|
||||
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 */
|
||||
vector<string> booksIds = library.listBooksIds(kiwix::LOCAL);
|
||||
vector<string> booksIds = library.filter(kiwix::Filter().local(true));
|
||||
globalSearcher = new kiwix::Searcher();
|
||||
globalSearcher->setProtocolPrefix(rootLocation + "/");
|
||||
globalSearcher->setSearchProtocolPrefix(rootLocation + "/" + "search?");
|
||||
|
Loading…
x
Reference in New Issue
Block a user