Add ebook filter to mybooks + use standard sort dropper#11868
Merged
mekarpeles merged 2 commits intointernetarchive:masterfrom Feb 23, 2026
Merged
Add ebook filter to mybooks + use standard sort dropper#11868mekarpeles merged 2 commits intointernetarchive:masterfrom
mekarpeles merged 2 commits intointernetarchive:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an ebook filter to the reading log pages (want-to-read, currently-reading, already-read) and standardizes the sort options UI by using the same dropdown component from the authors page. Users can now filter their reading log to show only ebooks using a mode parameter, with toggle links to switch between showing everything and only ebooks.
Changes:
- Added ebook filtering functionality using Solr filter queries with
ebook_accessfield - Replaced custom sort UI with standard
sort_options.htmltemplate component - Added CSS styling for filter controls and adjusted header padding
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| openlibrary/plugins/upstream/mybooks.py | Added mode parameter handling and fq (filter query) construction for ebook filtering in both web and JSON endpoints |
| openlibrary/core/bookshelves.py | Added fq parameter to reading log query functions to support additional Solr filter queries |
| openlibrary/templates/account/reading_log.html | Replaced custom sort UI with standard template, added ebook filter toggle, and updated conditional display logic |
| openlibrary/templates/search/sort_options.html | Added reading_log search scheme with Date Added sort options |
| static/css/components/mybooks-list.less | Added margin spacing for chip-group and search-results-stats elements |
| static/css/components/mybooks-details.less | Removed header padding to align with standard sort dropper UI |
| openlibrary/i18n/messages.pot | Moved translation strings for sort options from reading_log.html to sort_options.html for reuse |
Comments suppressed due to low confidence (3)
openlibrary/core/bookshelves.py:406
- The docstring should be updated to document the new fq parameter, which is used to apply additional Solr filter queries (e.g., for ebook filtering). Consider adding something like ":param fq: optional list of Solr filter queries to apply to the results."
"""
Returns LoggedBooksData containing Reading Log database records for books that
the user has logged. Also allows filtering/searching the reading log shelves,
and sorting reading log shelves (when not filtering).
The returned records ultimately come from Solr so that, as much as possible,
these query results may be used by anything relying on logged book data.
:param username: who logged this book
:param bookshelf_id: the ID of the bookshelf, see: PRESET_BOOKSHELVES.
If bookshelf_id is None, return books from all bookshelves.
:param q: an optional query string to filter the results.
"""
openlibrary/core/bookshelves.py:472
- The docstring should be updated to document the new fq parameter, which is used to apply additional Solr filter queries. Consider adding documentation for this parameter to explain its purpose and expected format.
"""
Filter reading log books based an a query and return LoggedBooksData.
This does not work with sorting.
The reading log DB alone has access to who logged which book to their
reading log, so we need to get work IDs and logged info from there, query
Solr for more complete book information, and then put the logged info into
the Solr response.
"""
openlibrary/plugins/upstream/mybooks.py:573
- The docstring should be updated to document the new fq parameter. Consider adding documentation for all parameters including the new fq parameter to explain their purposes.
"""
Get works for want-to-read, currently-reading, and already-read as
determined by {key}.
See LoggedBooksData for specifics on what's returned.
"""
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
lokesh
added a commit
to lokesh/openlibrary
that referenced
this pull request
Feb 23, 2026
…s (ported to CSS) Ported mybooks-details.less change (removed header padding) and mybooks-list.less changes (chip-group margin, search-results-stats margin) to their CSS equivalents. Deleted incoming .less file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lokesh
added a commit
to lokesh/openlibrary
that referenced
this pull request
Feb 23, 2026
…s (ported to CSS) Ported mybooks-details.less change (removed header padding) and mybooks-list.less changes (chip-group margin, search-results-stats margin) to their CSS equivalents. Deleted incoming .less file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uses the UI from the authors page; although we should change this to be a toggle button!
Technical
Testing
Screenshot
Before:

After:

Stakeholders
@mekarpeles @davidscotson