-
-
Notifications
You must be signed in to change notification settings - Fork 65
Cleanup of suggestions code #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It helps to reduce boilerplate code in tests.
The helper utilities getSuggestions() and EXPECT_SUGGESTION_RESULTS in the suggestion unit-test actually return and check only titles. So renamed them as follows, so that the old names can then be used for new helpers for more exhaustive testing of suggestions: getSuggestions() -> getSuggestedTitles() EXPECT_SUGGESTION_RESULTS() -> EXPECT_SUGGESTED_TITLES()
zim::Archive::Entry::offset() is not a state modifier method. The bug was hiding there for almost four years and was not observed as it only applied to paging of suggestions in the absence of Xapian DB. Paging (infinite scrolling) of suggestions in the UI was implemented in kiwix-desktop last year and was (naturally) tested only on ZIM archives with Xapian indexes.
The diff is a little easier to understand if whitespace changes are ignored.
It was used to get rid of the custom copy-constructor and copy-assignment operator in SuggestionIterator::SuggestionInternalData, but probably may be (re)used in other code like that.
Didn't replace `std::unique_ptr` with `ValuePtr` in `mp_rangeIterator` and `mp_internal` data members of `zim::SuggestionIterator` since the latter is part of the libzim public API (and that would require making `smartptr.h` a public header file).
Moved the declaration of SuggestionIterator::SuggestionInternalData
to suggestion_iterator.cpp. As a result, had to move the definition of
SuggestionResultSet::{begin,end}() there, too.
Renamed SuggestionIterator::Impl::{mp_internalDb -> mp_db}
... instead of the full Xapian document
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1006 +/- ##
==========================================
+ Coverage 57.96% 58.13% +0.17%
==========================================
Files 101 101
Lines 5407 5384 -23
Branches 2219 2197 -22
==========================================
- Hits 3134 3130 -4
+ Misses 800 795 -5
+ Partials 1473 1459 -14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Rewrote the Suggestion.indexFullPath unit-test by checking the Xapian data directly.
Having data members conditionally compiled makes the libzim ABI dependent on the build type which can lead to crashes if a wrong build of libzim is used with the client application. This commit doesn't fully solve the problem since LIBZIM_WITH_XAPIAN is still used in include/zim/suggestion.h
cf894d8 to
5d00100
Compare
|
@veloman-yunkan Few questions my side:
|
@kelson42 I intended to have it merged right before #1007, but as a refactoring/cleanup effort it makes sense to commit this work regardless of whether any subsequent changes dependent on it follow.
Did you mean no API and behaviour change? If yes, then mostly yes. There is one bug-fix for an exotic scenario.
Yes, this is a purely clean-up PR. |
This is the clean-up work extracted from #994