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 warnings.
Kishore Nallan2dbce214c05e
diff --git a/src/field.cpp b/src/field.cppindex c6b7d5e0..1ec4438f 100644--- a/src/field.cpp+++ b/src/field.cpp@@ -394,11 +394,12 @@ Option<bool> toParseTree(std::queue<std::string>& postfix, filter_node_t*& root,bool is_successful = true;std::string error_message;+ filter_node_t *filter_node = nullptr;+while (!postfix.empty()) {const std::string expression = postfix.front();postfix.pop();- filter_node_t *filter_node = nullptr;if (isOperator(expression)) {if (nodeStack.empty()) {is_successful = false;@@ -452,6 +453,9 @@ Option<bool> toParseTree(std::queue<std::string>& postfix, filter_node_t*& root,}if (!is_successful) {+ delete filter_node;+ filter_node = nullptr;+while (!nodeStack.empty()) {auto filterNode = nodeStack.top();delete filterNode;diff --git a/src/index.cpp b/src/index.cppindex 1553cc59..214a061a 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -3770,8 +3770,10 @@ void Index::search_across_fields(const std::vector<token_t>& query_tokens,for(size_t i = 0; i < num_search_fields; i++) {const std::string& field_name = the_fields[i].name;- const uint32_t field_num_typos = (i < num_typos.size()) ? num_typos[the_fields[i].orig_index] : num_typos[0];- const bool field_prefix = (i < prefixes.size()) ? prefixes[the_fields[i].orig_index] : prefixes[0];+ const uint32_t field_num_typos = (the_fields[i].orig_index < num_typos.size())+ ? num_typos[the_fields[i].orig_index] : num_typos[0];+ const bool field_prefix = (the_fields[i].orig_index < prefixes.size()) ? prefixes[the_fields[i].orig_index]+ : prefixes[0];if(token_num_typos > field_num_typos) {// since the token can come from any field, we still have to respect per-field num_typosdiff --git a/test/collection_specific_more_test.cpp b/test/collection_specific_more_test.cppindex 468c2f8c..92ee07b2 100644--- a/test/collection_specific_more_test.cpp+++ b/test/collection_specific_more_test.cpp@@ -2222,7 +2222,7 @@ TEST_F(CollectionSpecificMoreTest, ApproxFilterMatchCount) {filter_tree_root);ASSERT_TRUE(filter_op.ok());- uint32_t approx_count;+ uint32_t approx_count = 0;coll->_get_index()->_approximate_filter_ids(filter_tree_root->filter_exp, approx_count);ASSERT_EQ(approx_count, 5);