-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adds ability to search/filter one's reading log #7052
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
Adds ability to search/filter one's reading log #7052
Conversation
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.
The approach looks solid to me :P We'll need to provide all the data from the db to the endpoints anyways. The only potential downside is that there are now two solr requests, but we can speed that up by limiting the info we get back here. And honestly if that means having to update half the codebase so that it expects solr docs, then your approach is definitely the better solution! This looks good to me! Just need to do some testing :)
5bcc6ec
to
e0d85e4
Compare
Thank you for all the suggested changes, @cdrini. I have updated the PR to include them. Additionally I've addressed, I believe, the bug where filtering the reading log was not working when a user was not logged in. (I had simply failed to pass I will address pagination in a separate PR. |
e0d85e4
to
1395bc3
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 looking good! One little change. Pushing to testing afresh for QA!
1395bc3
to
8227d86
Compare
I've updated the draft PR and if possible I would like to try it on testing. Some places that deserve special attention:
Other things of note:
Things that remain:
Sadly, I don't think the code is any more clear now (yet?). |
95f535f
to
e1688c2
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.
Let's also add q
to the json endpoint for consistency!
Otherwise is looking good! Investigating a weird possible perm issue :P Possible unrelated to this PR.
Thank you for taking the time to try to clean this up a little 😊
73784f2
to
32809f2
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.
Looking good! Let me push up that solr param change, and put up on testing!
cb3b2aa
to
2e73424
Compare
2e73424
to
cb3b2aa
Compare
cb3b2aa
to
562216d
Compare
c9efbe6
to
ad0ffdd
Compare
ad0ffdd
to
91324d4
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.
1 failing test left! :)
Test:
-
✅ Pagination w no search
-
✅ No q= more than 2k
-
✅ Sorting no search
-
✅ Set sort, then search
-
✅ Set page, then search, page removed
-
✅ JSON endpoint w/o q
-
❌ JSON endpoint w/ q
- edition IDs mis-aligned
-
✅ JSON endpoint w/ q and sort
-
✅ JSON endpoint w/ q and sort and page
-
✅ Moving things btwn shelves
-
✅ Add rating when querying
-
✅ Move btwn shelves when querying
-
✅ Can't see other users reading log
-
✅ Can't see other users reading log with q
-
✅ Can't see other users reading log with .json
-
✅ Searching user reading log with 20k books works!
-
✅ Reading log stats
This adds querying to the JSON endpoints. I am hopeful it's fixed the edition IDs being mis-aligned, but for some reason in my local development environment I never have the edition IDs. That said, injecting the edition IDs into the Solr results now uses a dictionary with a key of the work ID, and a value of a I included two commits in this latest change: one addressing the JSON endpoint and the logged_date/edition ID stuff, and another refactoring Another thing to draw attention to, in the latter commit, is that I made it so if someone goes to Lastly, I did not do a great job reducing redundancy in Edit: We need to test loans/waitlists. I think I can't fully test that locally. Why I suspect we can remove the waitlists and loans things that I've removed in
I just hope I am right about all of that. |
632e36f
to
37a13d3
Compare
…hanged self.KEYS to a Literal in ReadingLog() to get hints working end to end. Removed unused functions related to loans and waitlists in ReadingLog.
37a13d3
to
b957256
Compare
for doc in self.docs: | ||
work_id = extract_numeric_id_from_olid(doc.key) | ||
rating = Ratings.get_users_rating_for_work(self.username, work_id) | ||
self.ratings.append(rating or 0) |
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.
In a future PR it would be great to make this one bulk request! Now that it's in one place :)
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.
Ok!! Final stretch!
Co-authored-by: Drini Cami <cdrini@gmail.com>
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.
Ran the tests one more time; works like a charm!
Solr-side of things deployed! This should be able to just go out normally on Monday :) |
Closes #5080. This may need significantly more work, however.
Feature. Adds basic capacity to filter/search one's reading log.
Technical
What this does, in theory
This draft PR likely needs some work, but before getting the problems, first comes an explanation of how this theoretically works:
do_search
. This would be easy enough to change I think by switching torun_solr_query
(unless it's possible to specify fields indo_search
.Issues
get_users_logged_books
incore/bookshelves.py
;process_logged_books
inupstream/mybooks.py
, etc.bookshelves.py
,do_search
is conditionally imported. This likely will need a better solution, though I didn't put any time into it on the theory that maybe this implementation has no future.Testing
Screenshot
Already Read, without any filtering:

Searching for 'twain':

Same search, but with the sort order showing oldest-added first:

Searching a shelf of 29 books for the phrase "web":

A not very good screenshot of trying to enter < 3 characters into the search:

Doing a GET request for a search of <= 2 characters just returns everything on the shelf, with the usual pagination and no filtering. (Though there is no indication that the search didn't work, aside from not mentioning results):

Thanks to
@cdrini for walking me through a lot of it, and @mekarpeles for the detailed explanation of the steps.
Stakeholders
@mekarpeles, @cdrini