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:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user