Implement filter on last modified date by server (#8131)

* Implement filter on last modified date by server
Especially relevant for API, to get the modified changes: the API will now return the articles that are new or which content has been modified since `ot`:

fix https://github.com/FreshRSS/FreshRSS/issues/7304
fix https://github.com/FreshRSS/FreshRSS/issues/2566
https://github.com/jocmp/capyreader/discussions/533#discussioncomment-11341808

New corresponding search operator `mdate:` and new UI:

<img width="650" height="627" alt="image" src="https://github.com/user-attachments/assets/8ba02937-abc7-44bf-b718-cf269cc37caf" />

* Migration from existing id column

* Fix auto-update

* Index after update for performance

* Minor comment

* Minor whitespace

* Fix regex

* Minor .gitignore

* Changelog and warning

* Update app/i18n/pl/gen.php

Co-authored-by: Inverle <inverle@proton.me>

* make fix-all

* Optimise SQL auto-update
For speed and resilience

* Minor SQLite change of sequence

* Changelog

* Speed optimisation: No DEFAULT 0

* Better migration

* Revert small bug

* Prepare filtering on multiple dates for API

* make fix-all

* Update tests

* Remaining manual merge

* Update versions

* Remove warnings no longer relevant in changelog

* Implement in API, and COALESCE

* No lastModified when adding new article

* Rework logic

* Sort IS NOT NULL

* Remove forgotten lastModified

---------

Co-authored-by: Inverle <inverle@proton.me>
This commit is contained in:
Alexandre Alapetite
2026-03-01 21:43:03 +01:00
committed by GitHub
parent 9f0a8deb6f
commit cf631b6f87
44 changed files with 424 additions and 89 deletions

View File

@@ -45,7 +45,8 @@ CREATE TABLE IF NOT EXISTS `entry` (
`link` VARCHAR(16383) NOT NULL,
`date` BIGINT,
`lastSeen` BIGINT DEFAULT 0,
`lastUserModified` BIGINT DEFAULT 0, -- v1.28.0
`lastModified` BIGINT, -- v1.29.0
`lastUserModified` BIGINT, -- v1.28.0
`hash` BINARY(16), -- v1.1.1
`is_read` BOOLEAN NOT NULL DEFAULT 0,
`is_favorite` BOOLEAN NOT NULL DEFAULT 0,
@@ -59,8 +60,9 @@ CREATE TABLE IF NOT EXISTS `entry` (
CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `entry`(`is_favorite`);
CREATE INDEX IF NOT EXISTS entry_is_read_index ON `entry`(`is_read`);
CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `entry`(`lastSeen`); -- //v1.1.1
CREATE INDEX IF NOT EXISTS entry_last_modified_index ON `entry` (`lastModified`);
CREATE INDEX IF NOT EXISTS entry_last_user_modified_index ON `entry` (`lastUserModified`);
CREATE INDEX IF NOT EXISTS entry_feed_read_index ON `entry`(`id_feed`,`is_read`); -- v1.7
CREATE INDEX IF NOT EXISTS entry_last_user_modified_index ON `entry` (`lastUserModified`); -- //v1.28.0
INSERT OR IGNORE INTO `category` (id, name) VALUES(1, 'Uncategorized');
@@ -102,10 +104,15 @@ CREATE INDEX IF NOT EXISTS entrytag_id_entry_index ON `entrytag` (`id_entry`);
SQL;
$GLOBALS['ALTER_TABLE_ENTRY_LAST_USER_MODIFIED'] = <<<'SQL'
ALTER TABLE `entry` ADD `lastUserModified` BIGINT DEFAULT 0; -- 1.28.0
ALTER TABLE `entry` ADD COLUMN `lastUserModified` BIGINT; -- 1.28.0
CREATE INDEX IF NOT EXISTS entry_last_user_modified_index ON `entry` (`lastUserModified`);
SQL;
$GLOBALS['ALTER_TABLE_ENTRY_LAST_MODIFIED'] = <<<'SQL'
ALTER TABLE `entry` ADD COLUMN `lastModified` BIGINT; -- 1.29.0
CREATE INDEX IF NOT EXISTS entry_last_modified_index ON `entry` (`lastModified`);
SQL;
$GLOBALS['SQL_DROP_TABLES'] = <<<'SQL'
DROP TABLE IF EXISTS `entrytag`;
DROP TABLE IF EXISTS `tag`;