Add indexed title field for efficient keyword search in @mention system#823
Conversation
Add a `title` field to nodes for efficient @mention autocomplete search. The title contains markdown-stripped content for clean display and search. Key changes: - Add `title` field (TYPE option<string>) to node schema with index - Create `utils::strip_markdown` function using LazyLock and regex patterns - Populate title for root nodes (no parent) and task nodes (always) - Update mention_autocomplete to search title field instead of content - Sync title when content/node_type changes in update operations Title logic: - Root nodes: title = strip_markdown(content), except date/schema types - Task nodes: always get title regardless of hierarchy level - Child nodes: no title (not meaningful standalone search targets) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collection nodes are organizational containers that shouldn't appear in @mention search results. Added 'collection' to the exclusion list alongside 'date' and 'schema'. Note: This hardcoded exclusion will be refactored to a schema-driven approach in issue #824 (title_template support). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Mark hardcoded type exclusions (date, schema, collection) for future refactoring to schema-driven title_template approach in issue #824. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review SummaryReview Type: Initial Review Overall AssessmentThis is a well-designed implementation that adds an indexed Recommendation: APPROVE The changes represent a clear net improvement to the codebase with proper architecture, good test coverage, and clear documentation of future refactoring (TODO #824). Requirements ValidationFrom Issue #821: Phase 1: Schema & Backend
Phase 2: Query Integration
Phase 3: Migration & Testing
Phase 4: Quality
Code Review FindingsCritical IssuesNone identified. Suggested Improvements
Nitpicks
Architecture & Design AnalysisStrengths:
Trade-offs (Acceptable):
Security Analysis
Test Coverage Assessment
Final NotesThis PR demonstrates good engineering practices:
The implementation correctly addresses the core problem (efficient @mention search) while setting up for future improvements (schema-driven title templates). Reviewed by: Principal Engineer Reviewer (Pragmatic Quality Framework) |
Address reviewer suggestion: The whitespace regex was being compiled on every call to strip_markdown(). Now uses LazyLock for consistency with the MARKDOWN_PATTERNS static. Addresses review recommendation from PR #823. Co-Authored-By: Claude <noreply@anthropic.com>
Review Recommendations AddressedSummary:
Implemented Changes🟢 Suggestion: Static regex compilation (
Skipped Recommendations (with Justification)
Tests
Addressed by: Implementation Agent (Address Review Framework) |
…em (#823) * feat: Add indexed title field for @mention search (closes #821) Add a `title` field to nodes for efficient @mention autocomplete search. The title contains markdown-stripped content for clean display and search. Key changes: - Add `title` field (TYPE option<string>) to node schema with index - Create `utils::strip_markdown` function using LazyLock and regex patterns - Populate title for root nodes (no parent) and task nodes (always) - Update mention_autocomplete to search title field instead of content - Sync title when content/node_type changes in update operations Title logic: - Root nodes: title = strip_markdown(content), except date/schema types - Task nodes: always get title regardless of hierarchy level - Child nodes: no title (not meaningful standalone search targets) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Exclude collection nodes from title synchronization Collection nodes are organizational containers that shouldn't appear in @mention search results. Added 'collection' to the exclusion list alongside 'date' and 'schema'. Note: This hardcoded exclusion will be refactored to a schema-driven approach in issue #824 (title_template support). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: Add TODO comments for schema-driven title refactor (#824) Mark hardcoded type exclusions (date, schema, collection) for future refactoring to schema-driven title_template approach in issue #824. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * perf: Use static LazyLock for whitespace regex in strip_markdown Address reviewer suggestion: The whitespace regex was being compiled on every call to strip_markdown(). Now uses LazyLock for consistency with the MARKDOWN_PATTERNS static. Addresses review recommendation from PR #823. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…em (#823) * feat: Add indexed title field for @mention search (closes #821) Add a `title` field to nodes for efficient @mention autocomplete search. The title contains markdown-stripped content for clean display and search. Key changes: - Add `title` field (TYPE option<string>) to node schema with index - Create `utils::strip_markdown` function using LazyLock and regex patterns - Populate title for root nodes (no parent) and task nodes (always) - Update mention_autocomplete to search title field instead of content - Sync title when content/node_type changes in update operations Title logic: - Root nodes: title = strip_markdown(content), except date/schema types - Task nodes: always get title regardless of hierarchy level - Child nodes: no title (not meaningful standalone search targets) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Exclude collection nodes from title synchronization Collection nodes are organizational containers that shouldn't appear in @mention search results. Added 'collection' to the exclusion list alongside 'date' and 'schema'. Note: This hardcoded exclusion will be refactored to a schema-driven approach in issue #824 (title_template support). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: Add TODO comments for schema-driven title refactor (#824) Mark hardcoded type exclusions (date, schema, collection) for future refactoring to schema-driven title_template approach in issue #824. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * perf: Use static LazyLock for whitespace regex in strip_markdown Address reviewer suggestion: The whitespace regex was being compiled on every call to strip_markdown(). Now uses LazyLock for consistency with the MARKDOWN_PATTERNS static. Addresses review recommendation from PR #823. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…em (#823) * feat: Add indexed title field for @mention search (closes #821) Add a `title` field to nodes for efficient @mention autocomplete search. The title contains markdown-stripped content for clean display and search. Key changes: - Add `title` field (TYPE option<string>) to node schema with index - Create `utils::strip_markdown` function using LazyLock and regex patterns - Populate title for root nodes (no parent) and task nodes (always) - Update mention_autocomplete to search title field instead of content - Sync title when content/node_type changes in update operations Title logic: - Root nodes: title = strip_markdown(content), except date/schema types - Task nodes: always get title regardless of hierarchy level - Child nodes: no title (not meaningful standalone search targets) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Exclude collection nodes from title synchronization Collection nodes are organizational containers that shouldn't appear in @mention search results. Added 'collection' to the exclusion list alongside 'date' and 'schema'. Note: This hardcoded exclusion will be refactored to a schema-driven approach in issue #824 (title_template support). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: Add TODO comments for schema-driven title refactor (#824) Mark hardcoded type exclusions (date, schema, collection) for future refactoring to schema-driven title_template approach in issue #824. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * perf: Use static LazyLock for whitespace regex in strip_markdown Address reviewer suggestion: The whitespace regex was being compiled on every call to strip_markdown(). Now uses LazyLock for consistency with the MARKDOWN_PATTERNS static. Addresses review recommendation from PR #823. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Closes #821