Tristan Havelick
58be502f3f
add book titles to search results
2022-02-16 12:50:18 +01:00
Nikhil Tanwar
261adf0ef9
Add method to change MHD_OPTION_PER_IP_CONNECTION_LIMIT
...
Adds new method setIpConnectionLimit() to server.
Default is 0 (infinite)
2022-02-05 18:31:42 +05:30
Matthieu Gautier
84587e7f03
Add a new private constructor not deprecated for Reader.
...
As we still create a `Reader` in the deprecated code of `Library`,
we need a way to create a reader without raising a deprecated warning.
So we create a another constructor with a dummy argument and we use it.
2022-01-18 12:22:11 +01:00
Matthieu Gautier
fcd865bb81
Revert removing of deprecated methods used by android wrapper.
2022-01-14 12:28:50 +01:00
Matthieu Gautier
e5eeb08206
Remove old deprecated methods.
2022-01-13 14:23:29 +01:00
Matthieu Gautier
ac6f91798f
Assume `SuggestionItem` has a public constructor.
...
`SuggestionItem` is somehow a simple container.
2022-01-13 14:23:29 +01:00
Matthieu Gautier
e5d26a4699
Deprecate `SearchRenderer` creation from a `Searcher`.
2022-01-13 14:23:29 +01:00
Matthieu Gautier
3d64a9d9a9
Deprecate `Searcher` creation.
...
As the `Searcher` is now deprecated, we also remove the unit tests on it.
`Searcher` is now untested, and so it reduces the code coverage.
2022-01-13 14:23:29 +01:00
Matthieu Gautier
fb7d9f02c8
Deprecate `Reader` creation.
...
As we `Reader` is now deprecated, we also remove the unit tests on it.
`Reader` is now untested, and so it reduces the code coverage.
2022-01-13 14:23:29 +01:00
Matthieu Gautier
96e0d15ab4
Deprecate `Entry` creation.
...
As the `Entry` is still created by `Reader` we need a way to create a
entry without raising a deprecated warning.
To do so we create a second constructor with a dummy argument.
This second constructor is private and is not marked as deprecated so we
can use it.
2022-01-13 14:23:29 +01:00
Matthieu Gautier
39732e2bcf
Deprecate methods on Book.
...
- `update(const Reader& reader)` is replaced by
`update(const zim::Archive& archive)`
- `getFavicon*()` is replaced by `getIllustration(48)->*`
2022-01-12 18:07:46 +01:00
Emmanuel Engelhart
aa50845e22
Fix small typos in comments
2022-01-09 20:05:30 +01:00
Nikhil Tanwar
3dbcbe542b
Add tests for kiwix::fileExists and kiwix::fileReadable
2022-01-10 00:18:44 +05:30
Nikhil Tanwar
854058f842
Introduce kiwix::fileReadable
...
kiwix::fileExists only checks for file existence now
kiwix::fileReadable will check if the file is readable (implicitly checking for file existence also)
2022-01-05 20:16:38 +05:30
Matthieu Gautier
9482bfb95b
Add a method to get the a book illustration for a specific size.
2022-01-04 14:16:46 +01:00
Emmanuel Engelhart
f36d8e9851
New kiwix::getVersions() and printVersions()
2022-01-02 12:22:11 +01:00
Nikhil Tanwar
9554ab5db0
Make getNetworkInterfaces() and getBestPublicIp() available via tools.h
...
Remove HTTP URL helper line - should be done in kiwix-serve
Add getters at server level - getAddress and getPort
2021-12-22 22:38:16 +05:30
Veloman Yunkan
405ea29900
Added Library::addOrUpdateBook() alias
2021-11-30 18:20:27 +04:00
Veloman Yunkan
7161db8e2a
Manager::reload() also removes books from Library
2021-11-30 18:20:27 +04:00
Veloman Yunkan
262e13845c
Enter Library::removeBooksNotUpdatedSince()
2021-11-30 18:20:27 +04:00
Veloman Yunkan
473d2d2a69
Introduced Library::getBookByIdThreadSafe()
2021-11-30 18:20:27 +04:00
Veloman Yunkan
02b9e32d18
Library became almost thread-safe
...
Library became thread-safe with the exception of `getBookById()`
and `getBookByPath()` methods - thread safety in those accessors is
rendered meaningless by their return type (they return a reference
to a book which can be removed any time later by another thread).
2021-11-30 18:20:27 +04:00
Veloman Yunkan
c2927ce6f7
Library got a yet unused mutex
...
Introducing a mutex in `Library` necessitates manually implementing the
move constructor and assignment operator. It's better to still delegate
that work to the compiler to eliminate any possibility of bugs when new
data members are added to `Library`. The trick is to move the data into
an auxiliary class `LibraryBase` and derive `Library` from it.
2021-11-30 18:20:27 +04:00
Veloman Yunkan
b712c732f2
Dropped Library::getBookBy*() non-const functions
2021-11-30 18:20:27 +04:00
Veloman Yunkan
298247ca9b
Renamed NameMapperProxy -> UpdatableNameMapper
2021-11-30 18:20:27 +04:00
Veloman Yunkan
3aeeeeee76
Manager::reload()
2021-11-30 18:20:27 +04:00
Veloman Yunkan
226dac2604
LibraryManipulator is now merely a notifier
...
Originally `LibraryManipulator` was an abstract class completely decoupled
from `Library`. Its `addBookToLibrary()` and `addBookmarkToLibrary()`
methods could be defined in an arbitrary way. Now `LibraryManipulator` has to be
bound to a library object, those methods are no longer virtual, they always
update the library and allow for some additional actions via virtual
functions `bookWasAddedToLibrary()` and `bookmarkWasAddedToLibrary()`.
2021-11-30 18:20:27 +04:00
Veloman Yunkan
76a5e3a877
Library::addBook() updates the reader cache
2021-11-30 18:20:27 +04:00
Veloman Yunkan
6199c11505
NameMapperProxy respects the withAlias flag
2021-11-30 18:18:16 +04:00
Veloman Yunkan
8fffa59974
Added NameMapperProxy from kiwix/kiwix-desktop#714
...
The right place for NameMapperProxy introduced by kiwix/kiwix-desktop#714 is in
libkiwix (so that it can be reused in kiwix-serve).
2021-11-30 18:18:16 +04:00
Veloman Yunkan
5f3c34ed93
NameMapper's API is now const
2021-11-22 21:06:27 +04:00
Veloman Yunkan
571e417d1e
Manager is now safe to copy
2021-11-20 20:38:39 +04:00
Veloman Yunkan
913a368a12
Made Manager's ctors explicit
2021-11-20 20:34:13 +04:00
Veloman Yunkan
4a01081e83
Thread-safe Book::Illustration::getData()
2021-11-19 16:44:25 +04:00
Veloman Yunkan
eb6a0d6456
Enter Book::getIllustrations()
2021-11-18 14:39:00 +04:00
Veloman Yunkan
9f42884507
Book's illustrations are now immutable
2021-11-18 14:39:00 +04:00
Veloman Yunkan
8a6adddc16
Non-throwing Book::getDefaultIllustration()
2021-11-18 14:39:00 +04:00
Veloman Yunkan
c8da5eea2b
Dropped Book::getMutableDefaultIllustration()
...
Now a Book is created without a default illustration.
2021-11-18 14:38:00 +04:00
Veloman Yunkan
f4bc3c8ced
Book::Illustration got dimensions
2021-11-18 14:34:51 +04:00
Veloman Yunkan
5263f6880c
Internally Book supports multiple illustrations
2021-11-18 14:34:51 +04:00
Veloman Yunkan
9f0db6b7fa
Book::Illustration::getData()
2021-11-18 14:33:50 +04:00
Veloman Yunkan
7d8a83cc97
Encapsulated access to Book::m_illustration
2021-11-18 14:32:52 +04:00
Veloman Yunkan
ec5a423924
Enter Book::Illustration
...
`Book::m_favicon` and its 2 friends are replaced with a single
`Book::m_illustration` data member.
2021-11-18 13:31:08 +04:00
Veloman Yunkan
811b73a4f1
Moved 2 small method definitions to cpp
2021-11-18 13:27:27 +04:00
Veloman Yunkan
3e5372ef29
RIP Book::{setFavicon(),setFaviconMimeType()}
2021-11-18 13:25:34 +04:00
Manan Jethwani
30e4c549e4
exposed fileExist, getMimeTypeForFile and getFileCoontent functions
2021-10-12 19:44:38 +05:30
Manan Jethwani
b7b385d87b
added custom index template
2021-10-12 19:44:05 +05:30
Veloman Yunkan
4c657c082e
/catalog/v2/partial_entries OPDS API endpoint
2021-09-09 12:19:22 +04:00
Veloman Yunkan
12d9b69806
OPDSDumper::dumpOPDSCompleteEntry()
2021-09-09 12:19:22 +04:00
Maneesh P M
8a4080baba
Update libkiwix with new libzim api
2021-08-14 22:26:39 +05:30
Maneesh P M
9addd82d2d
Fix usage of zim::Searcher::getResults() in libkiwix
...
The correct usage does not require the user to calculate an `end` using
the `pageLength`. We can directly use getResults(start, pageLength)
2021-08-04 19:20:50 +05:30
Maneesh P M
19afe9442f
Remove OriginId functions since they are not useful right now
2021-08-03 11:42:58 +02:00
Maneesh P M
8b12434ff2
Update kiwix::book to use libzim structure
...
Some methods in kiwix::Book uses wrapper structure reader. This usage should
be extended from the native libzim structure zim::Archive
2021-08-03 11:42:58 +02:00
Veloman Yunkan
ab3095745e
Languages OPDS feed includes book counts
2021-08-03 11:32:38 +02:00
Veloman Yunkan
96cf7e78a5
OPDSDumper::categoriesOPDSFeed() with no args
2021-08-03 11:32:38 +02:00
Veloman Yunkan
5f90f5ee2a
Preliminary version of /catalog/v2/languages
2021-08-03 11:32:38 +02:00
Veloman Yunkan
18871b4b15
Helper function Library::getBookPropValueSet()
...
Introduced a helper function `Library::getBookPropValueSet()` and
deduplicated Library::getBooks{Languages,Creators,Publishers}() methods.
2021-08-03 11:32:38 +02:00
Matthieu Gautier
0b6b6716de
Rename split argument from `trimEmpty` to `dropEmpty`.
2021-07-07 14:43:13 +02:00
Matthieu Gautier
18b6433322
Correct method declaration in `SuggestionItem`
2021-07-07 14:43:13 +02:00
Matthieu Gautier
b70c92cade
Move back used helper functions to the public API.
...
- Add docstring
- Move the declaration in kiwix namespace.
- Adapt our include to include the right headers.
2021-07-07 14:43:13 +02:00
Matthieu Gautier
09d843da3a
Add a (empty) `include/tools.h` header.
...
This header will contain our public tool functions.
2021-07-07 14:43:13 +02:00
Matthieu Gautier
fa83a61a54
Move all public *Tools.h in src.
...
This by definition remove all the tool functions from the public API.
2021-07-07 14:43:13 +02:00
Maneesh P M
bcece66960
Add SearchRenderer handles for libzim structures
...
Introduces a new member mp_search that houses the zim::Search object,
adds a new constructor for this purpose. This commit also add an
overload for getHtml that takes start and end integers as arguments
since they are not part of the search object we include.
2021-07-03 14:05:50 +05:30
Maneesh P M
c046f64d83
Drop Reader and Entry wrappers from handle_content
2021-07-03 14:05:50 +05:30
Maneesh P M
75b4d311d7
Drop Reader from InternalServer::handle_random
2021-07-03 14:04:04 +05:30
Maneesh P M
a236751c74
Drop usage of Reader from InternalServer::handle_suggest
2021-07-03 14:04:04 +05:30
Maneesh P M
7d68926539
Drop usage of Reader from InternalServer::handle_meta
...
This is essentially a code move of meta handlers from using Reader
functions to directly using Archive.
2021-07-03 14:04:02 +05:30
Maneesh P M
940368b8ac
Add m_archives and getArchiveById to Library
...
These members will mirror the functionality offered by equivalent usage
of Reader class.
2021-07-03 14:02:31 +05:30
Veloman Yunkan
b5c1b26761
OpdsCatalog::getSearchUrl()
2021-06-30 18:27:00 +02:00
Veloman Yunkan
e799f2ff1e
OPDSDumper::dumpOPDSFeed() works via mustache
...
This changes the output of `/catalog/search` as follows:
- Entire search query (rather than only the value of the `q` parameter)
is put in the <title> node.
- Search performed with an empty query presents itself as "All zims".
- The feed id remains stable for identical searches on the same
library.
2021-06-08 20:37:00 +04:00
Veloman Yunkan
9ca6bd006f
/catalog/v2/categories goes through OPDSDumper too
2021-06-08 20:37:00 +04:00
Veloman Yunkan
cdacc0caf1
/catalog/v2/entries going through OPDSDumper
...
OPDSDumper sensed threats to its job security, so it lobbied to be
involved in handling the /catalog/v2 endpoints, too.
2021-06-08 20:37:00 +04:00
Veloman Yunkan
b259afa408
Library::getBooksCategories()
...
Note: no unit test added
2021-06-08 20:37:00 +04:00
Veloman Yunkan
54b78eaf56
Moved gen_date_str() to tools/otherTools.cpp
2021-06-08 16:03:43 +04:00
Maneesh P M
e2f6d91d51
Remove get_readerIndex in favor of get_zimId
...
The function get_readerIndex was used to get the zimId using an ordered
vector of readers. Now we can use get_zimId directly.
2021-05-26 14:45:25 +02:00
Maneesh P M
c35f6f9142
Add `get_zimId` method to Result
...
get_zimId method allows the user to get the uuid of the archive from
which a result is retrieved directly from the search result itself.
2021-05-26 14:45:25 +02:00
Maneesh P M
5567d8ca49
Replace std::vector<std::string> with SuggestionItem
...
Each sugestions used to be stored as vector of strings to hold various values
such as title, path etc inside them. With this commit, we use the new
dedicated class `SuggestionItem` to do the same.
2021-05-26 10:53:39 +02:00
Maneesh P M
5315034afe
Introduce `SuggestionItem` class
...
This is a helper class that allows to create and manage individual
suggestion item and their data.
2021-05-26 10:53:00 +02:00
Emmanuel Engelhart
d4e35c7067
Rename kiwix-lib in libkiwix
2021-05-23 21:46:52 +02:00
Veloman Yunkan
cd02b4de3b
Dummy application of new libzim search API
...
Didn't take any advantage of the new libzim search API. Just fixed the
libkiwix build in the most straightforward way.
2021-05-15 23:34:51 +04:00
Veloman Yunkan
3879b82112
const-correct kiwix::Library
...
- Made most methods of kiwix::Library const.
- Also added const versions of getBookById() and getBookByPath()
methods.
2021-04-28 11:42:55 +04:00
Veloman Yunkan
9c7366890d
Catalog filtering by tags works via Xapian
2021-04-27 16:59:21 +04:00
Veloman Yunkan
19e195cb7d
Filter::Tags typedef
2021-04-27 16:59:21 +04:00
Veloman Yunkan
3d5fd8f585
Catalog filtering by creator works via Xapian
2021-04-27 16:59:21 +04:00
Veloman Yunkan
a759ab989f
Catalog filtering by publisher works via Xapian
2021-04-27 16:59:21 +04:00
Veloman Yunkan
7ccd9ffcce
Catalog filtering by language works via Xapian
2021-04-27 16:59:21 +04:00
Veloman Yunkan
0c0a37073b
Catalog filtering by category works via Xapian
2021-04-27 16:59:21 +04:00
Veloman Yunkan
415c65cf03
Catalog filtering by book name works via Xapian
2021-04-27 16:59:21 +04:00
Veloman Yunkan
80cd1fc989
Renamed 2 functions in Filter and Library
2021-04-27 16:59:21 +04:00
Veloman Yunkan
2d76f8395e
Dropped unused functions from Filter's private API
...
This should have been done back in PR #460
2021-04-27 16:59:21 +04:00
Veloman Yunkan
29a6a34ecf
Delimited kiwix::Filter's public and private APIs
2021-04-27 16:59:21 +04:00
Veloman Yunkan
aa2a031ba4
Xapian headers are not exposed through libkiwix
2021-04-07 18:24:33 +04:00
Veloman Yunkan
09233bf4f3
Support for partial queries in catalog search
...
The search text in the catalog query is interpreted as partial by
default, but partial query mode can be disabled in C++. The latter
possibility is not exposed via the /catalog/search kiwix-serve endpoint,
though.
2021-03-17 14:32:03 +01:00
Veloman Yunkan
a599fb3892
Initial version of Xapian-based catalog search
2021-03-17 14:32:03 +01:00
Veloman Yunkan
a17fc0ef2d
Library::getBooksByTitleOrDescription()
2021-03-17 14:32:03 +01:00
Veloman Yunkan
db06b2c7ca
Library::BookIdCollection typedef
2021-03-17 14:32:03 +01:00
Veloman Yunkan
a20f9e2ce1
Library::filter() works in two stages
...
1. Get the subset of books matching the q (title/description) parameter
of the search
2. Filter out books not matching the other parameters of the search.
Stage 1. currently works in the old way, but will be replaced by Xapian
based search in subsequent commits.
2021-03-17 14:32:03 +01:00
Veloman Yunkan
6b2067c236
Reading category element from OPDS stream
2021-03-17 14:10:57 +04:00
Veloman Yunkan
e55bf514e8
Dedicated 'category' parameter in catalog search
2021-03-17 14:10:57 +04:00
Veloman Yunkan
58186ffb26
kiwix::Book::getCategory()
2021-03-17 14:09:48 +04:00