mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 23:36:20 +00:00
feat(app): quick switcher also finds pages by block content
BlockHit carries the page id so a hit opens its page (journals included). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6d566ff6f
commit
b44cbee038
9 files changed
+204
-30
No files matched your search
@@ -291,8 +291,21 @@ class MemoryBackend implements GraphBackend {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<BlockHit>> searchBlocks(String query, {int limit = 20}) async =>
|
||||
[];
|
||||
Future<List<BlockHit>> searchBlocks(String query, {int limit = 20}) async {
|
||||
final q = query.trim().toLowerCase();
|
||||
if (q.isEmpty) return [];
|
||||
return [
|
||||
for (final e in outlines.entries)
|
||||
for (final n in e.value)
|
||||
if (n.content.toLowerCase().contains(q))
|
||||
BlockHit(
|
||||
id: n.id,
|
||||
content: n.content,
|
||||
pageId: e.key,
|
||||
pageTitle: pages[e.key]?.title ?? '',
|
||||
),
|
||||
].take(limit).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
String? assetPath(String hash) => null;
|
||||
|
||||
Reference in new issue
Block a user