Skip to content

Commit

Permalink
change art cont logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiscode committed Jun 20, 2024
1 parent 95c69cd commit 1ddd72c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions text-utils-prefix/src/art.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,20 @@ impl<V> AdaptiveRadixTrie<V> {

let mut i = 0;
while let Some(&j) = permutation.get(i) {
if node
.contains_prefix_iter(continuations[j].iter().filter(|&b| *b > 0).copied(), n)
.is_some()
{
let cont = &continuations[j];
if cont.is_empty() {
// empty continuations are always a match
result.push(j);
i += 1;
continue;
}
let mut cont = cont.iter().filter(|&b| *b > 0).copied().peekable();
if cont.peek().is_none() {
// continuations with only null bytes are never a match
i += 1;
continue;
}
if node.contains_prefix_iter(cont, n).is_some() {
result.push(j);
} else {
i += skips[i];
Expand Down

0 comments on commit 1ddd72c

Please sign in to comment.