| 919 | }; | 919 | }; |
| 920 | | 920 | |
| 921 | for (const chatFile of chatFiles) { | 921 | for (const chatFile of chatFiles) { |
| 922 | const chatInfo = await getChatInfo(chatFile, {}, false, hasTextMatch); | 922 | const matcher = query ? hasTextMatch : null; |
| | 923 | const chatInfo = await getChatInfo(chatFile, {}, false, matcher); |
| 923 | const hasMatch = hasTextMatch(chatInfo.file_id ?? '') || chatInfo.match; | 924 | const hasMatch = hasTextMatch(chatInfo.file_id ?? '') || chatInfo.match; |
| 924 | | 925 | |
| 925 | // Skip corrupted or invalid chat files | 926 | // Skip corrupted or invalid chat files |