refactor(search): session sidebar and project-context filters use the shared matcher

Sidebar session/folder/group search and the Todos, Memory, Plans and
Notes filters required the whole query as one literal substring; they
now match tokens in any order and ignore punctuation via
matchesRankQuery, keeping their own list order and tree structure.
This commit is contained in:
Bohdan Triapitsyn
2026-08-24 15:04:14 +03:00
parent c02d7ff399
commit da309a2a8d
7 changed files with 27 additions and 26 deletions
@@ -1,3 +1,4 @@
import { matchesRankQuery } from '@/lib/search/fuzzySearch';
import React from 'react';
import { toast } from '@/components/ui';
@@ -186,13 +187,10 @@ export const MemorySection: React.FC<{
};
}, [markViewed, viewKey]);
const visibleEntries = React.useMemo(() => {
const needle = query.trim().toLowerCase();
if (!needle) return entries;
return entries.filter((entry) => (
entry.title.toLowerCase().includes(needle) || entry.body.toLowerCase().includes(needle)
));
}, [entries, query]);
const visibleEntries = React.useMemo(
() => entries.filter((entry) => matchesRankQuery([entry.title, entry.body], query)),
[entries, query],
);
const handleDelete = React.useCallback(async (memoryId: string) => {
if (!await deleteEntry(scope, memoryId)) {