#15746
[Bug]: Database table search finds nothing when one member cell holds a string instead of an array; linked-doc titles are never searchable
What happened?
Self-hosted AFFiNE 0.27.4. The database table view's search box (the magnifier) returned no rows for any word, including a word in a plain-text row title.
Cause 1: a member cell in the wrong shape breaks the whole search.
- Some member-column cells in our databases are stored as a bare user id string (
"0f8d…") instead of an array (["0f8d…"]). They were written by an API client. cellValueGet(blocks/database/src/data-source.ts) runsschema.safeParse. On failure it returnsundefined, not the default[].- The member property's
rawValue.toString(packages/frontend/core/src/blocksuite/database-block/properties/member/define.ts) is({ value }) => value.join(',') ?? ''. Soundefined.jointhrows a TypeError. searchRowsMapping(data-view/src/core/view-manager/single-view.ts) callsstringValue$for every visible property of every row. The first non-matching row with such a cell throws, and no rows are shown at all.- Proof: hiding the member column in the view (so it is no longer in
propertyIds$) made the same search find the expected rows at once.
Cause 2: linked-doc titles are never searchable.
- A row whose title is a LinkedPage reference stores a single space with a reference attribute.
- The title property's
rawValue.toStringreturns that space. The resolved doc title exists only intoJson. - So the table search never matches the label the user sees. The workspace indexer also stores such a row with empty content.
Expected
- One malformed cell should not stop the search for the whole table.
toStringcould guard againstundefined((value ?? []).join(',')), orcellValueGetcould fall back torawValue.default()when the parse fails. - A linked-doc title should be searched by the title it displays.
Related: #8257 (search not working with a url-type column, the same class of failure).
Distribution version
Self-hosted server 0.27.4, web client and macOS desktop.
Are you self-hosting?
- Yes
Issue Status: 🆕 *Untriaged
*🆕 Untriaged
The team has not yet reviewed the issue. We usually do it within one business day. Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md
This is an automatic reply by the bot.