145
return;
146
}
148
>
this.documents.delete(key);
149
>
this.chunkCount -= doc.chunks.length;
150
>
151
>
// Update term occurrences for the document
152
>
for (const chunk of doc.chunks) {
153
>
for (const term of chunk.tf.keys()) {
154
>
const currentOccurrences = this.chunkOccurrences.get(term);
155
>
if (typeof currentOccurrences === 'number') {
156
>
const newOccurrences = currentOccurrences - 1;
157
>
if (newOccurrences <= 0) {
158
>
this.chunkOccurrences.delete(term);
159
>
} else {
160
>
this.chunkOccurrences.set(term, newOccurrences);
161
>
}
162
>
}
163
>
}
164
>
}
165
}
166