From 98f20a21912794c94cc860543d7c69bfee62e8bc Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Sun, 7 Jun 2026 03:53:46 +0200 Subject: [PATCH] fix(search): fix _toFtsQuery to split on non-word chars instead of stripping The old implementation stripped non-word chars within tokens, causing 'searchable-{timestamp}' to become 'searchable{timestamp}*'. FTS5 tokenizes on hyphens so the merged token never matched. Fix: split on [^\w]+ so each FTS token is queried separately. Co-Authored-By: Claude Sonnet 4.6 --- lib/data/repositories/email_repository_impl.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/data/repositories/email_repository_impl.dart b/lib/data/repositories/email_repository_impl.dart index a0bf36f..60bff5a 100644 --- a/lib/data/repositories/email_repository_impl.dart +++ b/lib/data/repositories/email_repository_impl.dart @@ -2992,9 +2992,7 @@ class EmailRepositoryImpl implements EmailRepository { static String _toFtsQuery(String query) { final words = query .trim() - .split(RegExp(r'\s+')) - .where((w) => w.isNotEmpty) - .map((w) => w.replaceAll(RegExp(r'[^\w]'), '')) + .split(RegExp(r'[^\w]+')) .where((w) => w.isNotEmpty) .toList(); if (words.isEmpty) return '';