-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Allow kiwix-serve to get suggestions of custom range #591
Conversation
Codecov Report
@@ Coverage Diff @@
## fix_get_results openzim/libzim#591 +/- ##
===================================================
- Coverage 64.92% 64.91% -0.01%
===================================================
Files 53 53
Lines 3738 3737 -1
Branches 1881 1874 -7
===================================================
- Hits 2427 2426 -1
Misses 1309 1309
Partials 2 2
Continue to review full report at Codecov.
|
f03a11f
to
cce75f6
Compare
src/server/internalServer.cpp
Outdated
@@ -353,6 +353,7 @@ SuggestionsList_t getSuggestions(const zim::Archive* const archive, | |||
// TODO: This case should be handled by libzim | |||
std::vector<std::string> variants = getTitleVariants(queryString); | |||
int currCount = 0; | |||
int suggestionCount = end - start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning that getting results of a certain range in a non-Xapian based search is not supported as of now, so we will simply consider the count of suggestions here.
This will anyway have to be implemented on libzim side after openzim/libzim#574
cce75f6
to
1bd389c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is good but I'm a bit disturbed by the idea of adding a somehow hidden feature, not tested and not used.
It would be nice to have this change associated with a change in the front end to use it (and some tests of the feature)
I'm supportive of this comment. IMO, we should have a dedicated automated test able that way for example to retrieve by range of 10 suggestions, around 100 suggestions. The case of stopping before the end, and reaching the end of available suggestions should be tested. Cases of giving out-of-bands values to the ABI should be properly tested as well. |
Thanks for the suggestion @kelson42 @mgautierfr. It revealed a nasty error openzim/libzim#595. Working on a fix, shouldn't take much time. |
1bd389c
to
78d1b2b
Compare
78d1b2b
to
af825d4
Compare
@kelson42 Added some unit tests for checking the added changes. Rebasing the PR on openzim/libzim#597 just to show the solution employed to our earlier tackled issue is employed here as well. |
@MananJethwani Would you please verify that this feature would effectively allow us for example to provide an "infinite" scroll possibility in the suggestion selecbox? |
796d3d8
to
c88dfa2
Compare
af825d4
to
72d4c19
Compare
9cff130
to
9addd82
Compare
@MananJethwani Coukd you please validate this PR? See my latest comment. |
2896b35
to
fad6919
Compare
@kelson42 The last review pointed out a lack of unit testing in this pr. I have added some new tests to demonstrate the features added. And hence, a new review is necessary. |
@maneeshpm Can you please rebase this branch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the two first commits are already merged in master.
They are keep in the PR by the rebase because they are using tab instead of space. We should simply remove them.
The update fix only one of my remarks. It add unit-test.
But we are adding a feature that no one is using. It would be nice to
make the kiwix-serve "frontend" uses the feature provided by the backend.
But this is js development and it should probably be made by a different developer. @kelson42 I let you decide on this. Having unit-test is enough for me.
199bf96
to
8066232
Compare
Rebased to fix the commit history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm adding a late remark.
This will allow handle_suggest API to accept two arguments `start` and `suggestionLength` that will allow handle_suggest to retrieve suggestions in the given range rather than the default 0-10 range.
8066232
to
61209ea
Compare
Fixes openzim/libzim#242
This PR will allow kiwix serve to retrieve suggestions of a given range that can be specified in the front end call. These changes will open up the backend to implement continuous scroll feature as specified in the issue. But that is rather working on the front end side and this PR is only "allowing" to enable the feature.
Changes included in this PR:
start
,suggestionLength
in the handle_suggest API that will retrieve suggestions in the range given by (start
,start+suggestionLength
).