Fix Prefix FST when a document is modified

This commit is contained in:
ManyTheFish 2024-10-02 12:48:41 +02:00
parent d79f75f630
commit 774ed28539

View File

@ -234,12 +234,18 @@ impl PrefixFstBuilder {
*current_prefix_is_modified = false;
}
*current_prefix_is_modified |= is_modified;
if deladd == DelAdd::Addition {
*current_prefix_count += 1;
}
if is_modified && !*current_prefix_is_modified {
if *current_prefix_count > self.prefix_count_threshold {
self.modified_prefixes.insert(current_prefix.clone());
}
*current_prefix_is_modified = true;
}
// There is enough words corresponding to this prefix to add it to the cache.
if *current_prefix_count == self.prefix_count_threshold {
builder.insert(prefix)?;