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
Use mt19937_64 directly for consistency.
kishorenca7fad633eb70
diff --git a/src/main/main.cpp b/src/main/main.cppindex 80606fe1..fc5ad311 100644--- a/src/main/main.cpp+++ b/src/main/main.cpp@@ -21,7 +21,7 @@ int main(int argc, char* argv[]) {Store *store = new Store(state_dir_path);CollectionManager & collectionManager = CollectionManager::get_instance();- collectionManager.init(store, 4, "abcd", "123");+ collectionManager.init(store, 4, "abcd");collectionManager.load();std::vector<field> fields_to_index = {diff --git a/src/string_utils.cpp b/src/string_utils.cppindex 2782c2b6..6de06f4c 100644--- a/src/string_utils.cpp+++ b/src/string_utils.cpp@@ -1,8 +1,8 @@#include "string_utils.h"#include <iostream>#include <openssl/evp.h>-#include <iomanip>#include <openssl/hmac.h>+#include <random>std::string lower_and_no_special_chars(const std::string & str) {std::stringstream ss;@@ -57,14 +57,14 @@ std::string StringUtils::randstring(size_t length, uint64_t seed) {"abcdefghijklmnopqrstuvwxyz""ABCDEFGHIJKLMNOPQRSTUVWXYZ";- thread_local static std::mt19937 rg(seed);- thread_local static std::uniform_int_distribution<std::string::size_type> pick(0, sizeof(chrs) - 2);+ thread_local static std::mt19937_64 mt_rand(seed);std::string s;s.reserve(length);while(length--) {- s += chrs[pick(rg)];+ size_t index = (mt_rand() % (sizeof(chrs) - 1));+ s += chrs[index];}return s;