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

fix the wrong boolean val (#1559)

Krunal Gandhi01bedbb342ab
diff --git a/include/collection.h b/include/collection.h
index cc9bba96..44d84092 100644
--- a/include/collection.h
+++ b/include/collection.h
@@ -279,7 +279,7 @@ private:
std::vector<std::pair<uint32_t, uint32_t>>& included_ids,
std::vector<uint32_t>& excluded_ids,
nlohmann::json& override_metadata,
- bool enable_typos_for_numerical_tokens=false) const;
+ bool enable_typos_for_numerical_tokens=true) const;
void populate_text_match_info(nlohmann::json& info, uint64_t match_score, const text_match_type_t match_type,
const size_t total_tokens) const;
@@ -584,7 +584,7 @@ public:
std::string conversation_id = "",
const std::string& override_tags_str = "",
const std::string& voice_query = "",
- bool enable_typos_for_numerical_tokens = false) const;
+ bool enable_typos_for_numerical_tokens = true) const;
Option<bool> get_filter_ids(const std::string & filter_query, filter_result_t& filter_result) const;
diff --git a/include/index.h b/include/index.h
index 3e2c3f22..6b63456a 100644
--- a/include/index.h
+++ b/include/index.h
@@ -685,7 +685,7 @@ public:
facet_index_t* _get_facet_index() const;
static int get_bounded_typo_cost(const size_t max_cost, const std::string& token, const size_t token_len,
- size_t min_len_1typo, size_t min_len_2typo, bool enable_typos_for_numerical_tokens=false);
+ size_t min_len_1typo, size_t min_len_2typo, bool enable_typos_for_numerical_tokens=true);
static int64_t float_to_int64_t(float n);
@@ -739,7 +739,7 @@ public:
const std::string& collection_name,
const drop_tokens_param_t drop_tokens_mode,
facet_index_type_t facet_index_type = DETECT,
- bool enable_typos_for_numerical_tokens = false
+ bool enable_typos_for_numerical_tokens = true
) const;
void remove_field(uint32_t seq_id, const nlohmann::json& document, const std::string& field_name,
@@ -962,7 +962,7 @@ public:
std::array<spp::sparse_hash_map<uint32_t, int64_t, Hasher32>*, 3>& field_values,
const std::vector<size_t>& geopoint_indices,
const std::string& collection_name = "",
- bool enable_typos_for_numerical_tokens = false) const;
+ bool enable_typos_for_numerical_tokens = true) const;
void find_across_fields(const token_t& previous_token,
const std::string& previous_token_str,
diff --git a/src/collection_manager.cpp b/src/collection_manager.cpp
index e2918b38..5e5a073c 100644
--- a/src/collection_manager.cpp
+++ b/src/collection_manager.cpp
@@ -1535,7 +1535,7 @@ Option<bool> CollectionManager::do_search(std::map<std::string, std::string>& re
size_t max_extra_suffix = INT16_MAX;
bool enable_highlight_v1 = true;
text_match_type_t match_type = max_score;
- bool enable_typos_for_numerical_tokens = false;
+ bool enable_typos_for_numerical_tokens = true;
size_t remote_embedding_timeout_ms = 5000;
size_t remote_embedding_num_tries = 2;
diff --git a/src/index.cpp b/src/index.cpp
index 4ccb37f4..67d5aa58 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -6365,7 +6365,7 @@ int Index::get_bounded_typo_cost(const size_t max_cost, const std::string& token
const size_t min_len_1typo, const size_t min_len_2typo,
bool enable_typos_for_numerical_tokens) {
- if(enable_typos_for_numerical_tokens && std::all_of(token.begin(), token.end(), ::isdigit)) {
+ if(!enable_typos_for_numerical_tokens && std::all_of(token.begin(), token.end(), ::isdigit)) {
return 0;
}
diff --git a/test/collection_specific_more_test.cpp b/test/collection_specific_more_test.cpp
index 6358c12a..0e2ad026 100644
--- a/test/collection_specific_more_test.cpp
+++ b/test/collection_specific_more_test.cpp
@@ -2746,7 +2746,7 @@ TEST_F(CollectionSpecificMoreTest, DisableTyposForNumericalTokens) {
HASH, 30000, 2, "",
{},{}, "right_to_left", true,
true, false, "", "", "",
- "", true);
+ "", false);
ASSERT_TRUE(res_op.ok());
ASSERT_EQ(1, res_op.get()["hits"].size());