Commit Graph

258 Commits

Author SHA1 Message Date
Ozzie Isaacs
ffddd85800 Merge remote-tracking branch 'fix/fixlter' into Develop 2026-05-09 10:19:57 +02:00
Ozzie Isaacs
f4ed816f6e Fixes from testrun 2026-04-26 07:27:06 +02:00
Ozzie Isaacs
c2b1950cd5 Merge remote-tracking branch 'opds_date_update/fix-opds-atom-updated-reflects-modifications' 2026-04-20 15:55:24 +02:00
haraldpdl
ab17992ebb fix(opds): atom:updated reflects last modification, not date added
Books.atom_timestamp returned Books.timestamp (date added), which is
set at import and never changes. OPDS clients use atom:updated to
decide whether a book has changed on the server, so cover swaps,
metadata edits, and any other post-import change were invisible to
sync clients; they would keep serving the stale cover and title
until a manual refresh.

Atom RFC 4287 defines updated as "the most recent instant in time
when an entry or feed was modified", and Calibre already tracks that
field as last_modified, bumping it on every metadata and cover edit.
Switching the property to return last_modified (with a fallback to
timestamp when last_modified is NULL) aligns Calibre-Web's behaviour
with the Atom contract.

This change only affects the OPDS feed's atom:updated element. Kobo
sync uses its own last_modified comparison path, so it is unaffected.
2026-04-19 10:51:45 +02:00
jvoisin
6208d5e264 Correctly filter results kobo API
Multiple Kobo API endpoints use calibre_db.get_book_by_uuid() at db.py:748-749,
which performs a raw unfiltered query, meaning that common_filters() isn't
applied, so tag-based ACLs, language restrictions, and archived-book filtering
are all bypassed.
2026-04-15 23:14:09 +02:00
jvoisin
b5da0df42a Prevent SQLI via dbpath
This is reachable only by the admin users, but is still a straightforward RCE
vector, if only via SQLite's `ATTACH DATABASE` trick
2026-04-14 23:23:12 +02:00
Ozzie Isaacs
00686ec1f2 Merge remote-tracking branch 'page_count/fix-series-list-view-sorts-by-name-instead-of-sort-field' 2026-03-07 10:24:58 +01:00
Ozzie Isaacs
7f7fc884c2 Fix for calibre 9.0 2026-01-31 12:31:44 +01:00
Ozzie Isaacs
10816c7f6d Merge remote-tracking branch 'performance_optimize-search-queries/performance/optimize-search-queries' into Develop 2025-12-06 11:54:28 +01:00
Ozzie Isaacs
fceca5cc08 Merge remote-tracking branch 'performance_optimize-search-queries/performance/optimize-search-queries' into Develop
Updated Requirements
2025-12-06 11:36:02 +01:00
Ozzie Isaacs
d2015dd998 Optimized search query 2025-12-05 16:33:30 +01:00
alcibiadesc
8544702bb2 Add security fixes and improvements to search optimization
- Add FTS5 table existence check to avoid log spam on non-FTS databases
- Escape FTS5 special characters (quotes) to prevent query errors
- Wrap FTS5 search terms in quotes for phrase matching accuracy
- Improve logging: change author ordering debug to warning for visibility
- Add comment explaining author_sort data issues

These changes improve robustness and security without affecting performance.
2025-11-01 20:05:53 +01:00
alcibiadesc
a3b5d2eac7 Optimize search performance for large libraries
This commit introduces several performance optimizations to the search
system, significantly reducing query times for large Calibre libraries.

Key improvements:

1. FTS5 Integration
   - Added FTS5 full-text search support with automatic fallback
   - Uses indexed search when available, providing sub-second results
   - Gracefully degrades to traditional search if FTS5 is unavailable

2. Query Optimization
   - Replaced expensive .any() subqueries with efficient JOIN-based
     subqueries for tags, series, authors, and publishers
   - Reduced SQL complexity and improved query planning
   - Added selectinload() for authors to prevent N+1 query problems

3. LIMIT+1 Pattern
   - Implemented LIMIT+1 estimation pattern in get_search_results()
   - Avoids expensive COUNT(*) operations on large result sets
   - Provides fast pagination without sacrificing accuracy

4. Author Ordering Optimization
   - Replaced nested database queries with O(1) dictionary lookups
   - Eliminated N+1 query anti-pattern in order_authors()
   - Reduced author sorting from O(n²) to O(n) complexity

Performance Impact:
In testing with a library of 129,000+ books, these optimizations reduced
search times from 3-9 seconds to 85-330ms, achieving 89-97% improvement
across different search types.

The changes maintain backward compatibility and include fallbacks for
environments without FTS5 support.
2025-11-01 19:48:16 +01:00
Asher Max Schweigart
cc0fbd7ce8 Adding Smashwords identifier 2025-04-29 14:31:19 -04:00
Asher Max Schweigart
521b46e60d Adding eBooks.com identifier type 2025-04-14 14:05:26 -04:00
Ozzie Isaacs
4583fc8023 Python 3.13 compatibility
Code cosmetics
2025-03-30 12:03:12 +02:00
Ozzie Isaacs
b8c3674be9 Merge remote-tracking branch 'storygraph/storygraph-id' 2025-03-30 09:00:01 +02:00
Ozzie Isaacs
854a7d020d Better error output for "empty" Author sort not working
Update bleach requirement
2025-03-28 17:23:45 +01:00
Jayson Rhynas
bc0e218e73 Added support for storgraph: identifiers 2025-03-18 11:51:43 -04:00
Ozzie Isaacs
344c0c7bc3 Bugfixes after testrun 2024-11-28 14:47:52 +01:00
Ozzie Isaacs
190ee09e60 update Tests
Per request db connection
2024-11-26 06:13:18 +01:00
Ozzie Isaacs
8873381290 Merge remote-tracking branch 'amazon_links/patch-2' 2024-11-23 10:19:18 +01:00
Ozzie Isaacs
ebb7ddec44 Merge remote-tracking branch 'whatsapp/patch-4' 2024-11-23 10:06:22 +01:00
Webysther Sperandio
366a65f99f Increase sqlite calibre cache 2024-10-23 22:22:50 +02:00
Webysther Sperandio
fea8a9d40d Update with all amazon site that diverge in domain style 2024-09-25 01:07:22 +02:00
Ozzie Isaacs
2f39e51e1c Fix for #3151 (Invalid amazon link for uk) 2024-09-21 12:58:12 +02:00
Ozzie Isaacs
1eb77c9cd4 Upload (multiple) book formats with progress and merge the corresponding metadata into the book 2024-08-17 15:34:50 +02:00
Ozzie Isaacs
87b82424d5 Improved whitespace removal
Testresults
2024-08-13 07:07:54 +02:00
Ozzie Isaacs
7a8d054b28 Make datetime utcnow compatible to older python versions 2024-08-10 21:05:29 +02:00
Ozzie Isaacs
a56d1c80ae Remove deprecated utcnow method
Bugfix mp3 cover metadata extraction
2024-08-10 18:55:24 +02:00
Ozzie Isaacs
ebe7cd7ba4 proxy login is now no longer saving cookies,
Cookies are saved in database for better Invalidation
Cookies expiry date is saved in database for further deletion (missing)
Database conversion is missing
2024-07-14 16:24:07 +02:00
Ozzie Isaacs
64e4a1155c Code cosmetics
Bugfix missing bleach tags (#3080)
Bugfix pdfreader
2024-06-20 19:12:46 +02:00
Kreeblah
ad05534ed2 Add support for barnesnoble identifier 2024-05-11 23:56:37 -07:00
Ozzie Isaacs
15952a764c Fix for #3021 (speed of calculating number of pages) 2024-04-07 18:49:18 +02:00
Ozzie Isaacs
b2a26a421c Removed deprecation warning for sqlalchemy2.0 2023-08-26 20:26:01 +02:00
Ozzie Isaacs
df74fdb4d1 Update edit identifiers 2023-07-29 11:10:54 +02:00
Ozzie Isaacs
3ef34c8f15 Bugfixes rename upper-lowercase after testrun 2023-06-08 10:28:42 +02:00
Ozzie Isaacs
bd4b7ffaba Fix for upper lower change of non ascii values in series, tags, ... 2023-05-30 20:02:52 +02:00
Ozzie Isaacs
fe4dc1bb8f Fix #2757 (Sqlalchemy >1.30 <1.4.24 wasn't supported anymore) 2023-04-22 09:25:54 +02:00
Ozzie Isaacs
6c6841f8b0 Further fixes for sqlalchemy 2.0 2023-04-12 18:56:21 +02:00
Ozzie Isaacs
b9c942befc Fix for 'NoneType' object has no attribute 'author_sort' while trying to read a book (#2733) 2023-03-31 07:48:18 +02:00
Ozzie Isaacs
e3fffa8a8f Bugfix backup metadata for custom date, custom categories 2023-03-20 19:57:05 +01:00
Ozzie Isaacs
43ee85fbb5 Removed unnecessary Unicode "u" 2023-01-21 15:23:18 +01:00
Ozzie Isaacs
a635e136be Added databazeknih to supported links 2022-12-25 13:10:21 +01:00
Ozzie Isaacs
59a5ccd05c Bugfixes after testrun 2022-09-25 19:36:40 +02:00
Ozzie Isaacs
c10708ed07 Backup metadata 4th step 2022-09-19 22:39:40 +02:00
Ozzie Isaacs
26be5ee237 Backup metadata 3rd step 2022-09-19 18:56:31 +02:00
Ozzieisaacs
241aa77d41 backup metadata second step 2022-09-14 17:03:48 +02:00
Ozzieisaacs
ca0ee5d391 backup metadata first step 2022-09-10 18:26:52 +02:00
Ozzieisaacs
110d283a50 Enable series type custom column 2022-09-10 17:17:20 +02:00