Skip to content

fix: index closed property values for search - #13438

Open
tiensonqin wants to merge 4 commits into
masterfrom
devin/1790338317-closed-value-searchable
Open

tiensonqin wants to merge 4 commits into
masterfrom
devin/1790338317-closed-value-searchable

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closed property values (choice options with :block/closed-value-property) were skipped by block->index, so they were never written to the blocks/blocks_fts search index. As a result, [[ page search could never surface them — typing a choice's exact title offered only "New page" even though the entity existed (repro: a nationality property with choice "Emma North" scoped to #Person shows "Emma North" in its outline but [[Emma North returned only unrelated results).

Changes:

  • Remove the (ldb/closed-value? block) clause from the when-not guard in block->index so closed values are indexed like other named entities.
  • When a closed choice has no :block/title, index it by :logseq.property/value (stringified) — numeric :number-type choices store {:logseq.property/value 42} per closed-value-new-block. Gated on ldb/closed-value? so ordinary numeric property-value blocks stay unindexed.
  • Add :logseq.property/value to the get-affected-blocks watch set and ref-affecting-attrs so editing or retracting a numeric choice's value reindexes it instead of leaving a stale title.
  • Bump search-db-version 4 → 5 to force a re-index for existing graphs.
  • New tests: block-index-uses-property-value-for-numeric-closed-choices, block-index-ignores-ordinary-numeric-value-blocks, sync-search-indice-reindexes-numeric-closed-choice-on-value-edit.

Hidden/deleted entities remain excluded via hidden-entity?; built-in/private pages still filtered by include-search-block? (built-in? + private-built-in-page? checks unchanged).

Verified manually in the dev app: after the fix, [[Emma North lists nationality → Emma North (the closed value) alongside the page/object results. All 68 frontend.worker.search-test tests pass; kondo clean.

Link to Devin session: https://app.devin.ai/sessions/a77503d623ca446890f381422e5678dc
Open in Devin Desktop: https://app.devin.ai/desktop/session/a77503d623ca446890f381422e5678dc?variant=devin
Requested by: @tiensonqin


Devin Review

Closed values (property choice options) were excluded from the search
index, so [[ links could never find or link them even by exact title.
Bump search-db-version to rebuild existing indexes.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

Numeric (:number type) closed choices store the number in
:logseq.property/value with no :block/title; index them by the value
so [[ search can find them too.
devin-ai-integration[bot]

This comment was marked as resolved.

…ric values

- Gate the :logseq.property/value title fallback on ldb/closed-value?
  so ordinary numeric property values stay unindexed.
- Watch :logseq.property/value datoms in get-affected-blocks and
  ref-affecting-attrs so numeric choice edits and retractions trigger
  reindex instead of leaving stale titles.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant