Skip to content

feat: full-text search — match note content in addition to title - #10

Open
ark-commits wants to merge 1 commit into
note-organization-basicsfrom
full-text-search
Open

feat: full-text search — match note content in addition to title#10
ark-commits wants to merge 1 commit into
note-organization-basicsfrom
full-text-search

Conversation

@ark-commits

@ark-commits ark-commits commented May 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Extends the search bar to filter notes by body content, not just title
  • A note now appears in results if the query matches either its title or any text in its content
  • Sorting behaviour is unchanged (pinned-first when no query; recency-first when searching)

Changes

Single-line extension to the visibleNotes useMemo filter in App.jsx. The existing normalizedSearchQuery (trimmed + lowercased) is already computed — the content check is added alongside the existing title check.

Test plan

  • Type a word that appears in a note's body but not its title — note should appear in results
  • Confirm title-only matches still work as before
  • Confirm an empty search query shows all notes (pinned first)
  • Type an uppercase query (e.g. Hello) — verify both title and content matches are case-insensitive
  • Confirm mobile drawer search behaves the same way

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Search now checks both note titles and content when filtering results. This provides more comprehensive search capabilities, helping users find relevant information regardless of whether it appears in the title or within the note body text. The enhancement makes note discovery more intuitive and efficient for improved information access overall.

Previously, the search bar only filtered notes by title. Now it also
matches against note body content, so users can find notes by what
they contain, not just what they're called.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/App.jsx`:
- Around line 208-213: The content filter currently uses searchQuery instead of
the normalizedSearchQuery, causing case/whitespace mismatches and violating the
useMemo dependency; update the filter in the return of the memoized selector
(the function using sortedNotes.filter) to use normalizedSearchQuery for both
note.title and note.content comparisons (i.e., replace the note.content check
that references searchQuery with normalizedSearchQuery) so the matching is
consistently normalized and matches the [notes, normalizedSearchQuery]
dependency contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8caced08-d262-438f-8892-c1e1a3a9fa35

📥 Commits

Reviewing files that changed from the base of the PR and between 56133b0 and e773466.

📒 Files selected for processing (1)
  • src/App.jsx

Comment thread src/App.jsx
Comment on lines +208 to 213
return sortedNotes.filter(
(note) =>
note.title.toLowerCase().includes(normalizedSearchQuery) ||
note.content.toLowerCase().includes(searchQuery),
)
}, [notes, normalizedSearchQuery])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use the normalized query for content matching.

Line 211 uses searchQuery instead of normalizedSearchQuery, so content search is no longer consistently case-insensitive/trimmed (and diverges from the memo dependency contract).

Suggested fix
     return sortedNotes.filter(
       (note) =>
         note.title.toLowerCase().includes(normalizedSearchQuery) ||
-        note.content.toLowerCase().includes(searchQuery),
+        note.content.toLowerCase().includes(normalizedSearchQuery),
     )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/App.jsx` around lines 208 - 213, The content filter currently uses
searchQuery instead of the normalizedSearchQuery, causing case/whitespace
mismatches and violating the useMemo dependency; update the filter in the return
of the memoized selector (the function using sortedNotes.filter) to use
normalizedSearchQuery for both note.title and note.content comparisons (i.e.,
replace the note.content check that references searchQuery with
normalizedSearchQuery) so the matching is consistently normalized and matches
the [notes, normalizedSearchQuery] dependency contract.

Repository owner deleted a comment from coderabbitai Bot May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant