Repository navigation
fix: speed up incremental search indexing - #12818
Conversation
There was a problem hiding this comment.
Pull request overview
This PR speeds up incremental search indexing after outliner transactions by avoiding vector-context expansion and by indexing only the directly affected entities (except for subtree removals on deletion), reducing repeated work during bulk sibling inserts.
Changes:
- Update
sync-search-indiceto (by default) skip vector-title generation and to index only directly affected blocks for structure changes, while preserving subtree removal for:logseq.property/deleted-at. - Include vector titles from the DB listener only when a semantic/vector index is present.
- Add/adjust tests to validate the new “directly affected only” behavior and add a 300-block performance regression guard for semantic-search enabled/disabled paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/test/frontend/worker/search_test.cljs |
Updates incremental-indexing expectations and adds deletion + performance regression tests. |
src/main/frontend/worker/search.cljs |
Refactors affected-entity collection and adds an incremental indexing path that can omit vector titles by default. |
src/main/frontend/worker/db_listener.cljs |
Gates incremental vector-title inclusion on the presence of a vector index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review pr |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30d4fae08c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| set)] | ||
| {:blocks-to-remove (distinct | ||
| (concat (entities-with-referrers-for db-before ref-eids) | ||
| (entities-for db-before direct-visibility-eids) |
There was a problem hiding this comment.
Remove hidden subtrees on parent visibility changes
When a page or block subtree becomes hidden only because its :block/parent changes, such as moving it under a parent that already has :logseq.property/hide?, the transaction only needs to contain the root parent datom. hidden-entity? follows hidden parents, but this direct-only removal path now drops just the root from the search indexes, leaving already-indexed descendants searchable until a full rebuild; the previous include-tree? path removed the whole affected subtree for these visibility changes.
Useful? React with 👍 / 👎.
30d4fae to
69b60c6
Compare
fix: speed up incremental search indexing
fix: speed up incremental search indexing
fix: speed up incremental search indexing
Summary
Speed up incremental search indexing after outliner transactions by avoiding vector-context expansion on direct block changes.
Root cause
sync-search-indicewas expanding each affected block to nearby vector context and then building contextual vector titles for every indexed block. Bulk insertion of sibling blocks repeatedly touched the same sibling sets, which made the indexing path scale poorly.Changes
include-vector-title?tofalseforsync-search-indice.:logseq.property/deleted-at, where page/block descendants must leave the index.Benchmark
Direct
sync-search-indicetiming for 300 newly inserted sibling blocks after the change:Verification
clojure -M:test compile testenv LOGSEQ_STABLE_IDENTS=1 node static/tests.js -v frontend.worker.search-testenv LOGSEQ_STABLE_IDENTS=1 node static/tests.js -v frontend.worker.db-listener-testgit diff --check