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
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Fix typo in test document harness.
Kishore Nallanc079b22cbdec
diff --git a/src/art.cpp b/src/art.cppindex 38f7703d..a158b236 100644--- a/src/art.cpp+++ b/src/art.cpp@@ -1085,8 +1085,8 @@ int art_iter_prefix(art_tree *t, const unsigned char *key, int key_len, art_callnew_current_row[0] = previous_row[0] + 1;\row_min = levenshtein_score(child_char, term, term_len, previous_row, new_current_row);\\- printf("fuzzy_recurse - score: %d, child char: %c, cost: %d, max_cost: %d, row_min: %d, depth: %d, term[depth]: %c \n",\- child->max_score, child_char, new_current_row[term_len], max_cost, row_min, depth, term[depth]);\+ printf("fuzzy_recurse - max_score: %d, child char: %c, cost: %d, max_cost: %d, row_min: %d, depth: %d, term[depth]: %c \n",\+ child->max_score, child_char, row_min, max_cost, row_min, depth, term[depth]);\\if(depth == term_len-1) {\/* reached end of term, and cost is below threshold, print children of this node as matches*/\@@ -1173,7 +1173,7 @@ static int art_iter_fuzzy_prefix_recurse(art_node *n, const unsigned char *term,return 0;}- printf("START PARTIAL: score: %d, partial_len: %d, partial: %s, term_len: %d, depth: %d\n",+ printf("START PARTIAL: max_score: %d, partial_len: %d, partial: %s, term_len: %d, depth: %d\n",n->max_score, n->partial_len, n->partial, term_len, depth);// internal node - first we check partial (via path compression) and then child index@@ -1213,7 +1213,7 @@ static int art_iter_fuzzy_prefix_recurse(art_node *n, const unsigned char *term,printf("NODE4\n");for (int i=0; i < n->num_children; i++) {char child_char = ((art_node4*)n)->keys[i];- printf("4!child_char: %c, %d, depth: %d", child_char, child_char, depth);+ printf("\n4!child_char: %c, %d, depth: %d", child_char, child_char, depth);art_node* child = ((art_node4*)n)->children[i];fuzzy_recurse(child, child_char, term, term_len, depth, previous_row, results);}@@ -1223,7 +1223,7 @@ static int art_iter_fuzzy_prefix_recurse(art_node *n, const unsigned char *term,printf("NODE16\n");for (int i=0; i < n->num_children; i++) {char child_char = ((art_node16*)n)->keys[i];- printf("16!child_char: %c, depth: %d", child_char, depth);+ printf("\n16!child_char: %c, depth: %d", child_char, depth);art_node* child = ((art_node16*)n)->children[i];fuzzy_recurse(child, child_char, term, term_len, depth, previous_row, results);}@@ -1236,7 +1236,7 @@ static int art_iter_fuzzy_prefix_recurse(art_node *n, const unsigned char *term,if (!ix) continue;art_node* child = ((art_node48*)n)->children[ix - 1];char child_char = (char)i;- printf("48!child_char: %c, depth: %d, ix: %d", child_char, depth, ix);+ printf("\n48!child_char: %c, depth: %d, ix: %d", child_char, depth, ix);fuzzy_recurse(child, child_char, term, term_len, depth, previous_row, results);}break;@@ -1246,7 +1246,7 @@ static int art_iter_fuzzy_prefix_recurse(art_node *n, const unsigned char *term,for (int i=0; i < 256; i++) {if (!((art_node256*)n)->children[i]) continue;char child_char = (char) i;- printf("256!child_char: %c, depth: %d", child_char, depth);+ printf("\n256!child_char: %c, depth: %d", child_char, depth);art_node* child = ((art_node256*)n)->children[i];fuzzy_recurse(child, child_char, term, term_len, depth, previous_row, results);}diff --git a/src/collection.cpp b/src/collection.cppindex 7095a80f..9d77a7de 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -83,6 +83,8 @@ void Collection::search(std::string query, size_t max_results) {}}+ //std::cout << "token_leaves.size = " << token_leaves.size() << std::endl;+Topster<100> topster;size_t total_results = 0;const size_t combination_limit = 10;diff --git a/src/main.cpp b/src/main.cppindex cd97a44c..a4bf1342 100644--- a/src/main.cpp+++ b/src/main.cpp@@ -13,8 +13,8 @@ using namespace std;int main() {Collection *index = new Collection();- //std::ifstream infile("/Users/kishore/others/wreally/typesense/test/documents.txt");- std::ifstream infile("/Users/kishore/Downloads/hnstories.tsv");+ std::ifstream infile("/Users/kishore/others/wreally/typesense/test/documents.txt");+ //std::ifstream infile("/Users/kishore/Downloads/hnstories.tsv");std::string line;@@ -33,7 +33,7 @@ int main() {cout << "FINISHED INDEXING!" << endl << flush;auto begin = std::chrono::high_resolution_clock::now();- index->search("thei rserch", 100);+ index->search("plant", 100);long long int timeMillis = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - begin).count();cout << "Time taken: " << timeMillis << "us" << endl;delete index;diff --git a/test/documents.txt b/test/documents.txtindex 6111b320..d276c2a6 100644--- a/test/documents.txt+++ b/test/documents.txt@@ -6,7 +6,7 @@ The heaviest martian spacecraft 13To what extent are the US modules of ISS based on the Spacelab design? 13Could future astronauts eat during EVAs? 12What is the power requirement of a spacesuit? 12-How does plant growing medium not scatter around?12+How does plant growing medium not scatter around? 12Is there research for the optimal small crew size for a long space voyage? 12Do long term missions receive insurance coverage? 12What do they exactly look for when searching for extraterrestrial intelligence? 12