mirror of
https://github.com/typesense/typesense.git
synced 2025-05-15 02:03:19 +08:00
Fixed a LEAF node issue for "amzfing" with threshold of 2.
Was producing too many spurious single char matches.
This commit is contained in:
parent
ba39be766c
commit
eb1e68620a
@ -1009,9 +1009,10 @@ static int art_iter_fuzzy_prefix_recurse(art_node *n, const unsigned char *term,
|
||||
|
||||
int row_min = 0;
|
||||
int current_row[term_len+1];
|
||||
copyIntArray(current_row, previous_row, term_len+1);
|
||||
current_row[0] = previous_row[0] + 1;
|
||||
|
||||
printf("LEAF KEY: %s\n", l->key);
|
||||
printf("LEAF KEY: %s, depth: %d\n", l->key, depth);
|
||||
|
||||
for(int idx=depth; idx<l->key_len && depth < term_len && row_min <= max_cost; idx++) {
|
||||
row_min = levenshtein_score(l->key[idx], term, term_len, previous_row, current_row);
|
||||
|
@ -30,8 +30,8 @@ int main() {
|
||||
num++;
|
||||
}
|
||||
|
||||
const unsigned char *prefix = (const unsigned char *) "amazin";
|
||||
art_iter_fuzzy_prefix(&t, prefix, strlen((const char *) prefix), 0, test_prefix_cb, NULL);
|
||||
const unsigned char *prefix = (const unsigned char *) "amzfing";
|
||||
art_iter_fuzzy_prefix(&t, prefix, strlen((const char *) prefix), 2, test_prefix_cb, NULL);
|
||||
// art_iter_prefix(&t, prefix, strlen((const char *) prefix), test_prefix_cb, NULL);
|
||||
|
||||
// art_iter(&t, test_prefix_cb, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user