feat: full-text search — match note content in addition to title - #10
Open
ark-commits wants to merge 1 commit into
Open
feat: full-text search — match note content in addition to title#10ark-commits wants to merge 1 commit into
ark-commits wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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
Comment on lines
+208
to
213
| return sortedNotes.filter( | ||
| (note) => | ||
| note.title.toLowerCase().includes(normalizedSearchQuery) || | ||
| note.content.toLowerCase().includes(searchQuery), | ||
| ) | ||
| }, [notes, normalizedSearchQuery]) |
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Single-line extension to the
visibleNotesuseMemofilter inApp.jsx. The existingnormalizedSearchQuery(trimmed + lowercased) is already computed — the content check is added alongside the existing title check.Test plan
Hello) — verify both title and content matches are case-insensitive🤖 Generated with Claude Code
Summary by CodeRabbit