skeeto / elfeed

An Emacs web feeds client
The Unlicense
1.52k stars 121 forks source link

Manually changing entry date breaks search function #503

Closed whudwl closed 9 months ago

whudwl commented 9 months ago

Say I've opened the top 1 entry from the default search view, the entry is dated 2024-02-13,for some reason I want to change its date. So I do this:

(setf  (elfeed-entry-date elfeed-show-entry) 1702621741.0) ; 2023-12-15 

It seems to work well. but afterwards, the search function would become weird, for examlpe, the search term @1-months-ago would return nothing at all.

skeeto commented 9 months ago

Entries are stored in an AVL tree keyed by date. If you change the key then you violate the tree invariants and corrupt your database. (So you probably already need to restore from a backup.) To change a date, the entry must be removed, modified, and then reinserted. If you really want to change the date yourself, make a shallow copy, modify the date, and then elfeed-db-add it, which will merge your change into the existing entry.

Though if that entry is seen again in a feed, Elfeed will force it back to the date reported by the feed, overriding your change. There's not much use in modifying metadata set by feeds, particularly dates, titles, and content. In the search listing, the :title metadata plist entry overrides the title struct slot for display purposes, but the slot itself remains out of your control.

whudwl commented 9 months ago

Thank you so much!