You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(fts): Add comprehensive Full Text Search management to CWA Settings
Implemented advanced FTS control interface in CWA Settings page with real-time
status monitoring, replacing basic checkbox in Basic Configuration with full
management capabilities including progress tracking and resource information.
Backend Changes (cps/cwa_functions.py):
- Added /fts-status GET route: Returns JSON with enabled/indexed/total/percentage/
available/active status, polling-friendly
- Added /fts-action POST route: Handles enable/disable/reindex actions with proper
subprocess confirmation handling
- Added _get_fts_status_from_calibredb(): Parses calibredb output, handles both
exit code 0 (enabled) and 2 (disabled) as valid responses
- Added _initialize_fts_index(): Enable/disable FTS with validation, checks actual
status before skipping enable when database exists
- Fixed duplicate_auto_resolve_cooldown_minutes handling: Added validation (0-1440),
default value (0), and fallback logic in integer settings processing
Frontend Changes (cps/templates/cwa_settings.html):
- New FTS Management section with live status display showing current state
(Active/Not Available/Disabled/Error) with emoji indicators
- Progress tracking: "X of Y books indexed (Z%)" with 90% threshold for availability
- Action buttons: Enable/Disable/Reindex/Refresh with proper state management
- JavaScript polling: 10-second intervals with visibility detection, stops during actions
- Network share warning: Static info box about slower indexing on NFS/SMB
- Disable behavior warning: Prominent alert that disabling requires complete re-indexing
(Calibre design limitation)
- Collapsible resource info: Details on CPU/disk/memory usage, performance characteristics,
large library considerations
Configuration Page Updates (cps/templates/config_edit.html):
- Added tooltip to FTS checkbox: "Manage FTS indexing in CWA Settings for advanced options"
- Added link to CWA Settings page for full management interface
Bug Fixes:
- Fixed Jinja2 translation errors: Removed colons from {{_()}} calls, escaped %% symbols
- Added @csrf.exempt to /fts-action route for AJAX POST requests
- Fixed calibredb subprocess confirmations:
* disable command requires input='disable\n'
* reindex command requires input='reindex\n'
- Fixed status parsing to handle "FTS Indexing is disabled" output (no book counts)
- Fixed duplicate_auto_resolve_cooldown_minutes displaying "False" instead of number
- Fixed enable command check to verify actual status when database exists but disabled
Technical Details:
- Exit codes: calibredb returns 0 when enabled, 2 when disabled (both valid)
- Status outputs: "X of Y books files indexed" (enabled) vs "FTS Indexing is disabled"
- 90% threshold: Search only activates when ≥90% of library indexed
- Active detection: Compares two sequential status checks to detect ongoing indexing
- Environment: All calibredb commands use LD_LIBRARY_PATH=/app/calibre/lib
Known Calibre Limitations:
- Disabling FTS invalidates the index, requiring full re-indexing on re-enable
(this is Calibre's design for index consistency, not a CWA bug)
- No pause/resume functionality available in calibredb fts_index commands
0 commit comments