mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 19:25:00 +03:00
The search extractor did not read inline `reference` attributes in rich
text, so a doc that links to another doc only through an inline mention
did not show as a backlink. It also dropped `prop:params` of linked and
synced doc embeds, and it did not index database columns, table cells
or LaTeX.
- Read the `reference` attribute of the visible runs in `prop:text` of
paragraph, list and code blocks. Parse each `reference` format once,
so a long run of text under one reference costs linear time.
- Keep `ref` unique by its full string and push the `pageId` of each kept
`ref` to `ref_doc_id`, so the two lists stay in step. Check database
cells one at a time, as the reader does.
- Serialize `ref` as `JSON.stringify({ docId, ...params })`. Spread
strings and arrays by index, put index keys first, and format numbers
as ECMAScript does.
- Keep only the `docId` when the params are larger than 256 KiB, nest
too deeply, have too many entries, or pass the 16 MiB budget of the
block. Check duplicates by the hash of the full reference, so such a
reference does not merge with a different reference to the same doc.
- Merge `prop:params` into the `ref` of `affine:embed-linked-doc` and
`affine:embed-synced-doc`, and keep an empty `pageId`.
- Index the database title, column names and select options from `Y.Map`
columns. Read cell references from `Y.Text` or from boxed text with a
truthy marker. Add `databaseName` to database blocks and row paragraphs.
- Read the text of each flavour as the old server does. Read rich text
only from `Y.Text`. Index the table cells in key order and the LaTeX
source.
- A note, frame or edgeless text with no text of its own joins the
text of its direct children, up to 1 MiB. Each child gives its text to
one container only.
- Index no text for doc embeds and bookmarks. Skip blocks with only
white space, and keep bookmark blocks.
- Raise `SCHEMA_FINGERPRINT` to 2, so that startup builds a new generation
and reprojects docs that did not change. Retire drained generations of
any schema version.
- Move the `TestDoc` builder to `tests/support`. Test each flavour, the
params spread, malformed input, the time for many runs and references,
backlinks through `search` and `aggregate`, and the schema upgrade.