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
Handle md5 context memory.
Kishore Nallan78f15fe6ddd4
diff --git a/src/embedder_manager.cpp b/src/embedder_manager.cppindex 52d2ce6f..4313709d 100644--- a/src/embedder_manager.cpp+++ b/src/embedder_manager.cpp@@ -274,6 +274,9 @@ const std::string EmbedderManager::get_absolute_config_path(const std::string& mconst bool EmbedderManager::check_md5(const std::string& file_path, const std::string& target_md5) {const size_t BUFF_SIZE = 4096 * 4;std::ifstream infile(file_path, std::ifstream::binary);+ if(infile.fail()) {+ return false;+ }EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); // md5 contextconst EVP_MD* md5Func = EVP_md5(); // use EVP md5 function@@ -289,6 +292,7 @@ const bool EmbedderManager::check_md5(const std::string& file_path, const std::sunsigned int md_len; // hash lengthunsigned char md5_value[EVP_MAX_MD_SIZE]; // actual hash valueEVP_DigestFinal_ex(mdctx, md5_value, &md_len);+ EVP_MD_CTX_free(mdctx);std::stringstream res;@@ -297,8 +301,7 @@ const bool EmbedderManager::check_md5(const std::string& file_path, const std::sres << std::hex << std::setfill('0') << std::setw(2) << (int)md5_value[i];}- std::string hash = res.str();- return hash == target_md5;+ return res.str() == target_md5;}Option<bool> EmbedderManager::download_public_model(const text_embedding_model& model) {