(entry: SearchEntry)
| 45 | } |
| 46 | |
| 47 | function addEntry(entry: SearchEntry): void { |
| 48 | const idx = entries.length; |
| 49 | entries.push(entry); |
| 50 | for (const token of tokenize(entry.text)) { |
| 51 | if (!index.has(token)) index.set(token, new Set()); |
| 52 | index.get(token)!.add(idx); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | function removeConversation(conversationId: string): void { |
| 57 | // Mark entries as removed (nullish id) — we rebuild if fragmentation grows |