Repository navigation
fix: reindex and resolve journals by current title format - #14060
tiensonqin wants to merge 1 commit into
Conversation
| (or (when (and journal-day | ||
| (= (common-util/page-name-sanity-lc page-name) | ||
| (common-util/page-name-sanity-lc | ||
| (date-time-util/int->journal-title journal-day formatter)))) | ||
| (:e (first (d/datoms db :avet :block/journal-day journal-day)))) |
There was a problem hiding this comment.
🔴 Date-named pages resolve to wrong journals
After changing formats, get-first-page-by-name returns a journal before an existing page with the same displayed title. Opening that page by name lands on the journal instead.
Learn more
A page name lookup previously selected the oldest page whose stored :block/name matched the requested name. Journal titles are now computed from the current format, while stored names remain unchanged. When the format changes, an existing ordinary page can have the same name as a journal's newly displayed title. The journal-day lookup wins even though the ordinary page is still present. get-page and the name lookup in get-block then select the wrong entity.
Example: Create an ordinary page named 20.01.2004 while journals use MMM do, yyyy, and create a journal for January 20, 2004. Change the journal format to dd.MM.yyyy. Opening 20.01.2004 now opens the journal rather than the ordinary page.
Recommended fix: Define collision precedence for stored-name matches versus computed journal titles. Preserve access to an exact stored-name page and provide an unambiguous journal lookup by day for the journal-specific paths.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Browser QACompared base Passed
Failed
Untested: RTC/multi-client, raw Datalog/plugin API readers. |
Summary
Display-only alternative to #14059: stored journal
:block/title/:block/nameare never rewritten when:logseq.property.journal/title-formatchanges; titles keep being computed at read time (entity_plus). This PR closes the two read-side gaps:get-affected-blocks): when the Journal formatter differs betweendb-beforeanddb-after, all:block/journal-dayentities are fed into the existing title-change invalidation path, so journals and blocks referencing them are reindexed with the new-format title.get-first-page-by-name): a string that round-trips exactly through the current formatter (normalized withpage-name-sanity-lc) resolves by journal-day; anything else (e.g.2021Q4, which the loose parser accepts underdd.MM.yyyy) falls back to stored-name lookup.No schema bump, migration, pipeline or exporter change.
Known tradeoff vs #14059: readers of raw stored datoms still see the old-format title/name — Datalog/query DSL title rules, case-sensitive title lookup, All Pages fast filter (
view.cljs), pluginget_all_pages, APIget-page-data, semantic search prefilter.Tests: search regressions (Settings
:set-block-propertyroute, new-format journal + referrer found, old format no longer matches, stored title/name unchanged) and lookup regressions incl.2021Q4.frontend.worker.pipeline-test+frontend.worker.search-test: 120 tests, 532 assertions, 0 failures; clj-kondo clean.Implemented in session Fix custom date format journal title and search
Review with Devin · Open in Devin Desktop