Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Intermediate matching nodes should not be pushed to the results vector.

Kishore Nallan2f26b95c5ba7
diff --git a/src/art.cpp b/src/art.cpp
index e729e015..993c42db 100644
--- a/src/art.cpp
+++ b/src/art.cpp
@@ -859,9 +859,9 @@ static int topk_iter(const art_node *root, int term_len, int k, std::vector<art_
if (!n) continue;
if (IS_LEAF(n)) {
art_leaf *l = (art_leaf *) LEAF_RAW(n);
- //printf("\nLEAF: %.*s", leaf->key_len, leaf->key);
+ //printf("\nTOPK LEAF: %.*s", l->key_len, l->key);
//std::cout << ", SCORE: " << l->token_count << std::endl;
- // This basically ignores tokens whose prefix match perfectly, but exceeding overal threshold
+ // This basically ignores tokens whose prefix match perfectly, but exceeding overall threshold
int diff = term_len - (int) l->key_len;
if(diff >= -2 && diff <= 2) {
results.push_back(l);
@@ -1235,11 +1235,6 @@ static void art_fuzzy_recurse(char p, char c, const art_node *n, int depth, cons
depth += n->partial_len;
printf("\ncost: %d", cost);
- if(depth >= term_len-1 && rows[j][columns-1] <= max_cost) {
- results.push_back(n);
- return ;
- }
-
art_fuzzy_children(c, n, depth, term, term_len, rows[i], rows[j], max_cost, results);
}
diff --git a/src/collection.cpp b/src/collection.cpp
index 426da486..a6a32898 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -101,7 +101,7 @@ std::vector<nlohmann::json> Collection::search(std::string query, const int num_
for(auto i=0; i<leaves.size(); i++) {
//printf("%s - ", token.c_str());
//printf("%.*s", leaves[i]->key_len, leaves[i]->key);
- //printf(" - max_cost: %d, - score: %d\n", max_cost, leaves[i]->token_count);
+ //printf(" - max_cost: %d, - score: %d\n", max_cost, leaves[i]->values->ids.getLength());
}
token_leaves.push_back(leaves);
}