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
Address -Wall and -Wextra warnings.
Kishore Nallanc3298ba6d8b3
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 445108fa..9c82d152 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1,8 +1,8 @@cmake_minimum_required(VERSION 2.8)project(typesense)-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -O0")+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wno-unused-parameter -O2")+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wno-unused-parameter -std=c++11 -O0")set(DEP_ROOT_DIR ${CMAKE_SOURCE_DIR}/external-${CMAKE_SYSTEM_NAME})set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")@@ -40,7 +40,6 @@ include(cmake/RocksDB.cmake)include(cmake/GoogleTest.cmake)include(cmake/TestResources.cmake)-FILE(GLOB HEADER_FILES include/*)FILE(GLOB SRC_FILES src/*.cpp)include_directories(include)diff --git a/include/art.h b/include/art.hindex 8de3b7a7..12068ec9 100644--- a/include/art.h+++ b/include/art.h@@ -248,7 +248,7 @@ int art_iter_prefix(art_tree *t, const unsigned char *prefix, int prefix_len, arint art_fuzzy_search(art_tree *t, const unsigned char *term, const int term_len, const int min_cost, const int max_cost,const int max_words, const token_ordering token_order, const bool prefix, std::vector<art_leaf *> &results);-int art_topk_iter(const art_node *root, token_ordering token_order, const int max_results,+int art_topk_iter(const art_node *root, token_ordering token_order, size_t max_results,std::vector<art_leaf *> &results);void encode_int32(int32_t n, unsigned char *chars);diff --git a/include/collection.h b/include/collection.hindex 83353fc0..97d4c532 100644--- a/include/collection.h+++ b/include/collection.h@@ -34,6 +34,8 @@ private:// Auto incrementing record ID used internally for indexing - not exposed to the clientuint32_t next_seq_id;+ Store* store;+std::vector<field> fields;std::unordered_map<std::string, field> search_schema;@@ -42,8 +44,6 @@ private:std::unordered_map<std::string, field> sort_schema;- Store* store;-std::string token_ranking_field;std::string get_doc_id_key(const std::string & doc_id);diff --git a/include/field.h b/include/field.hindex aebd90e8..e88b7c16 100644--- a/include/field.h+++ b/include/field.h@@ -149,7 +149,7 @@ struct facet_value {void index_values(uint32_t doc_seq_id, const std::vector<std::string> & values) {std::vector<uint32_t> value_vec(values.size());- for(auto i = 0; i < values.size(); i++) {+ for(size_t i = 0; i < values.size(); i++) {value_vec[i] = get_value_index(values[i]);}doc_values.emplace(doc_seq_id, value_vec);diff --git a/include/index.h b/include/index.hindex 48663a4a..05555a75 100644--- a/include/index.h+++ b/include/index.h@@ -54,8 +54,6 @@ class Index {private:std::string name;- uint32_t collection_id;-size_t num_documents;std::unordered_map<std::string, field> search_schema;diff --git a/include/match_score.h b/include/match_score.hindex 00d55ac2..cedb5eb0 100644--- a/include/match_score.h+++ b/include/match_score.h@@ -169,7 +169,7 @@ struct Match {std::fill_n(packed_offset_diffs, 16, 0);// identify the first token which is actually present and use that as the base for run-length encoding- int token_index = 0;+ size_t token_index = 0;while(token_index < token_offsets.size()) {if(min_token_offset[token_index] != MAX_DISPLACEMENT) {token_start_offset = min_token_offset[token_index];diff --git a/include/number.h b/include/number.hindex af930a51..3fea6ca5 100644--- a/include/number.h+++ b/include/number.h@@ -9,24 +9,24 @@ struct number_t {int64_t intval;};- number_t(): intval(0), is_float(false) {+ number_t(): is_float(false), intval(0) {}- number_t(bool is_float, float floatval): floatval(floatval), is_float(is_float) {+ number_t(bool is_float, float floatval): is_float(is_float), floatval(floatval) {}- number_t(bool is_float, int64_t intval): intval(intval), is_float(is_float) {+ number_t(bool is_float, int64_t intval): is_float(is_float), intval(intval) {}- number_t(float val): floatval(val), is_float(true) {+ number_t(float val): is_float(true), floatval(val) {}- number_t(int64_t val): intval(val), is_float(false) {+ number_t(int64_t val): is_float(false), intval(val) {}diff --git a/include/option.h b/include/option.hindex 442941ea..e1fb135e 100644--- a/include/option.h+++ b/include/option.h@@ -17,7 +17,7 @@ public:}- Option(const uint32_t code, const std::string & error_msg): error_code(code), error_msg(error_msg), is_ok(false) {+ Option(const uint32_t code, const std::string & error_msg): is_ok(false), error_msg(error_msg), error_code(code) {}diff --git a/include/person.h b/include/person.hdeleted file mode 100644index bd87e3c8..00000000--- a/include/person.h+++ /dev/null@@ -1,85 +0,0 @@-#pragma once--struct person {- bool is_float;- union {- int64_t intval;- float floatval;- };-- person(): intval(0), is_float(false) {-- }-- person(bool is_float, float floatval): floatval(floatval), is_float(is_float) {-- }-- person(bool is_float, int64_t intval): intval(intval), is_float(is_float) {-- }--- person(float val): floatval(val), is_float(true) {-- }-- person(int64_t val): intval(val), is_float(false) {-- }-- inline void operator = (const float & val) {- floatval = val;- is_float = true;- }-- inline void operator = (const int64_t & val) {- intval = val;- is_float = false;- }-- inline bool operator == (const person & rhs) const {- if(is_float) {- return floatval == rhs.floatval;- }- return intval == rhs.intval;- }-- inline bool operator < (const person & rhs) const {- if(is_float) {- return floatval < rhs.floatval;- }- return intval < rhs.intval;- }-- inline bool operator > (const person & rhs) const {- if(is_float) {- return floatval > rhs.floatval;- }- return intval > rhs.intval;- }-- inline person operator * (const person & rhs) const {- if(is_float) {- return person(floatval * rhs.floatval);- }- return person(intval * rhs.intval);- }-};--namespace std-{-// inject specialization of std::hash for Person into namespace std-// ----------------------------------------------------------------- template<>- struct hash<person>- {- std::size_t operator()(person const &p) const- {- std::size_t seed = 0;- spp::hash_combine(seed, p.is_float);- spp::hash_combine(seed, p.intval);- return seed;- }- };-}\ No newline at end of filediff --git a/include/replicator.h b/include/replicator.hindex 5430ce6c..b784e873 100644--- a/include/replicator.h+++ b/include/replicator.h@@ -31,7 +31,6 @@ public:}void Put(const rocksdb::Slice& key, const rocksdb::Slice& value) {- CollectionManager & collection_manager = CollectionManager::get_instance();std::vector<std::string> parts;StringUtils::split(key.ToString(), parts, "_");diff --git a/include/string_utils.h b/include/string_utils.hindex 491a48ca..baebbe28 100644--- a/include/string_utils.h+++ b/include/string_utils.h@@ -77,7 +77,7 @@ struct StringUtils {static bool is_float(const std::string &s) {std::string::const_iterator it = s.begin();bool decimalPoint = false;- int minSize = 0;+ size_t minSize = 0;if(s.size() > 0 && (s[0] == '-' || s[0] == '+')) {it++;minSize++;diff --git a/src/art.cpp b/src/art.cppindex 6dd01a1b..a2739e7f 100644--- a/src/art.cpp+++ b/src/art.cpp@@ -438,7 +438,7 @@ static art_leaf* make_leaf(const unsigned char *key, uint32_t key_len, art_documstatic uint32_t longest_common_prefix(art_leaf *l1, art_leaf *l2, int depth) {int max_cmp = min(l1->key_len, l2->key_len) - depth;- uint32_t idx;+ int idx;for (idx=0; idx < max_cmp; idx++) {if (l1->key[depth+idx] != l2->key[depth+idx])return idx;@@ -891,16 +891,16 @@ void* art_delete(art_tree *t, const unsigned char *key, int key_len) {return NULL;}-static uint32_t get_score(art_node* child) {+/*static uint32_t get_score(art_node* child) {if (IS_LEAF(child)) {art_leaf *l = (art_leaf *) LEAF_RAW(child);return l->values->ids.getLength();}return child->max_token_count;-}+}*/-int art_topk_iter(const art_node *root, token_ordering token_order, const int max_results,+int art_topk_iter(const art_node *root, token_ordering token_order, size_t max_results,std::vector<art_leaf *> &results) {printf("INSIDE art_topk_iter: root->type: %d\n", root->type);@@ -1452,7 +1452,7 @@ static void art_iter(const art_node *n, const unsigned char* int_str, int int_streturn ;}- int idx, res;+ int idx;switch (n->type) {case NODE4:for (int i=0; i < n->num_children; i++) {@@ -1606,7 +1606,7 @@ void art_int_fuzzy_recurse(art_node *n, int depth, const unsigned char* int_str,void compare_and_match_leaf(const unsigned char *int_str, int int_str_len, const NUM_COMPARATOR &comparator,std::vector<const art_leaf *> &results, const art_leaf *l) {if(comparator == LESS_THAN || comparator == GREATER_THAN) {- for(auto i = 0; i < l->key_len; i++) {+ for(uint32_t i = 0; i < l->key_len; i++) {if(int_str[i] != l->key[i]) {results.push_back(l);return ;diff --git a/src/collection.cpp b/src/collection.cppindex 01325bf4..862a2c22 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -28,7 +28,7 @@ Collection::Collection(const std::string name, const uint32_t collection_id, con}num_indices = 4;- for(auto i = 0; i < num_indices; i++) {+ for(size_t i = 0; i < num_indices; i++) {Index* index = new Index(name+std::to_string(i), search_schema, facet_schema, sort_schema);indices.push_back(index);std::thread* thread = new std::thread(&Index::run_search, index);@@ -39,7 +39,7 @@ Collection::Collection(const std::string name, const uint32_t collection_id, con}Collection::~Collection() {- for(auto i = 0; i < indices.size(); i++) {+ for(size_t i = 0; i < indices.size(); i++) {std::thread *t = index_threads[i];Index* index = indices[i];index->ready = true;@@ -402,7 +402,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<sreturn Option<nlohmann::json>(422, message);}- auto begin = std::chrono::high_resolution_clock::now();+ //auto begin = std::chrono::high_resolution_clock::now();// all search queries that were used for generating the resultsstd::vector<std::vector<art_leaf*>> searched_queries;@@ -450,7 +450,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<ssearched_queries.insert(searched_queries.end(), index->search_params.searched_queries.begin(),index->search_params.searched_queries.end());- for(auto fi = 0; fi < index->search_params.facets.size(); fi++) {+ for(size_t fi = 0; fi < index->search_params.facets.size(); fi++) {auto & this_facet = index->search_params.facets[fi];auto & acc_facet = facets[fi];@@ -496,7 +496,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<sconst int end_result_index = std::min(int(page * per_page), kvsize) - 1;- for(size_t field_order_kv_index = start_result_index; field_order_kv_index <= end_result_index; field_order_kv_index++) {+ for(int field_order_kv_index = start_result_index; field_order_kv_index <= end_result_index; field_order_kv_index++) {const auto & field_order_kv = field_order_kvs[field_order_kv_index];const std::string& seq_id_key = get_seq_id_key((uint32_t) field_order_kv.second.key);@@ -528,7 +528,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<sfor (const art_leaf *token_leaf : searched_queries[field_order_kv.second.query_index]) {std::vector<uint16_t> positions;- int doc_index = token_leaf->values->ids.indexOf(field_order_kv.second.key);+ uint32_t doc_index = token_leaf->values->ids.indexOf(field_order_kv.second.key);if(doc_index == token_leaf->values->ids.getLength()) {continue;}@@ -550,7 +550,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<s// unpack `match.offset_diffs` into `token_indices`std::vector<size_t> token_indices;- char num_tokens_found = match.offset_diffs[0];+ size_t num_tokens_found = (size_t) match.offset_diffs[0];for(size_t i = 1; i <= num_tokens_found; i++) {if(match.offset_diffs[i] != std::numeric_limits<int8_t>::max()) {size_t token_index = (size_t)(match.start_offset + match.offset_diffs[i]);@@ -606,7 +606,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<sreturn a.second > b.second;});- for(auto i = 0; i < std::min((size_t)10, value_to_count.size()); i++) {+ for(size_t i = 0; i < std::min((size_t)10, value_to_count.size()); i++) {auto & kv = value_to_count[i];nlohmann::json facet_value_count = nlohmann::json::object();facet_value_count["value"] = kv.first;@@ -617,7 +617,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<sresult["facet_counts"].push_back(facet_result);}- long long int timeMillis = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - begin).count();+ //long long int timeMillis = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - begin).count();//!std::cout << "Time taken for result calc: " << timeMillis << "us" << std::endl;//!store->print_memory_usage();return result;diff --git a/src/http_server.cpp b/src/http_server.cppindex f3abe170..258689d0 100644--- a/src/http_server.cpp+++ b/src/http_server.cpp@@ -378,7 +378,7 @@ int HttpServer::catch_all_handler(h2o_handler_t *_self, h2o_req_t *req) {}void HttpServer::send_message(const std::string & type, void* data) {- h2o_custom_res_message_t* message = new h2o_custom_res_message_t{{{NULL}}, this, type.c_str(), data};+ h2o_custom_res_message_t* message = new h2o_custom_res_message_t{{{NULL, NULL}}, this, type.c_str(), data};h2o_multithread_send_message(message_receiver, &message->super);}diff --git a/src/index.cpp b/src/index.cppindex 9ea98208..375b754d 100644--- a/src/index.cpp+++ b/src/index.cpp@@ -250,7 +250,7 @@ void Index::index_string_field(const std::string & text, const uint32_t score, anum_hits += 1;- for(auto i=0; i<kv.second.size(); i++) {+ for(size_t i=0; i<kv.second.size(); i++) {art_doc.offsets[i] = kv.second[i];}@@ -301,12 +301,12 @@ void Index::do_facets(std::vector<facet> & facets, uint32_t* result_ids, size_tconst field & facet_field = facet_schema.at(a_facet.field_name);const facet_value & fvalue = facet_index.at(facet_field.name);- for(auto i = 0; i < results_size; i++) {+ for(size_t i = 0; i < results_size; i++) {uint32_t doc_seq_id = result_ids[i];if(fvalue.doc_values.count(doc_seq_id) != 0) {// for every result document, get the values associated and increment counterconst std::vector<uint32_t> & value_indices = fvalue.doc_values.at(doc_seq_id);- for(auto j = 0; j < value_indices.size(); j++) {+ for(size_t j = 0; j < value_indices.size(); j++) {const std::string & facet_value = fvalue.index_value.at(value_indices.at(j));a_facet.result_map[facet_value] += 1;}@@ -321,8 +321,7 @@ void Index::search_candidates(uint32_t* filter_ids, size_t filter_ids_length, ststd::vector<std::vector<art_leaf*>> & searched_queries, Topster<512> & topster,size_t & total_results, uint32_t** all_result_ids, size_t & all_result_ids_len,const size_t & max_results, const bool prefix) {- const size_t combination_limit = 10;- const size_t prefix_candidates_limit = 5;+ const long long combination_limit = 10;auto product = []( long long a, token_candidates & b ) { return a*b.candidates.size(); };long long int N = std::accumulate(token_candidates_vec.begin(), token_candidates_vec.end(), 1LL, product);@@ -349,7 +348,7 @@ void Index::search_candidates(uint32_t* filter_ids, size_t filter_ids_length, st}// intersect the document ids for each token to find docs that contain all the tokens (stored in `result_ids`)- for(auto i=1; i < query_suggestion.size(); i++) {+ for(size_t i=1; i < query_suggestion.size(); i++) {uint32_t* out = nullptr;uint32_t* ids = query_suggestion[i]->values->ids.uncompress();result_size = ArrayUtils::and_scalar(ids, query_suggestion[i]->values->ids.getLength(), result_ids, result_size, &out);@@ -425,7 +424,7 @@ Option<uint32_t> Index::do_filtering(uint32_t** filter_ids_out, const std::vectouint32_t* filter_ids = nullptr;uint32_t filter_ids_length = 0;- for(auto i = 0; i < filters.size(); i++) {+ for(size_t i = 0; i < filters.size(); i++) {const filter & a_filter = filters[i];if(search_index.count(a_filter.field_name) != 0) {@@ -481,7 +480,7 @@ Option<uint32_t> Index::do_filtering(uint32_t** filter_ids_out, const std::vectouint32_t* filtered_ids = nullptr;size_t filtered_size = 0;- for(auto i = 0; i < str_tokens.size(); i++) {+ for(size_t i = 0; i < str_tokens.size(); i++) {std::string & str_token = str_tokens[i];StringUtils::normalize(str_token);art_leaf* leaf = (art_leaf *) art_search(t, (const unsigned char*) str_token.c_str(),@@ -582,10 +581,10 @@ void Index::search(Option<uint32_t> & outcome, std::string query, const std::vecconst uint32_t filter_ids_length = op_filter_ids_length.get();// Order of `fields` are used to sort results- auto begin = std::chrono::high_resolution_clock::now();+ //auto begin = std::chrono::high_resolution_clock::now();uint32_t* all_result_ids = nullptr;- for(int i = 0; i < search_fields.size(); i++) {+ for(size_t i = 0; i < search_fields.size(); i++) {Topster<512> topster;const std::string & field = search_fields[i];// proceed to query search only when no filters are provided or when filtering produces results@@ -596,7 +595,7 @@ void Index::search(Option<uint32_t> & outcome, std::string query, const std::vec}// order of fields specified matter: matching docs from earlier fields are more important- for(auto t = 0; t < topster.size && t < num_results; t++) {+ for(uint32_t t = 0; t < topster.size && t < num_results; t++) {field_order_kvs.push_back(std::make_pair(search_fields.size() - i, topster.getKV(t)));}}@@ -604,7 +603,7 @@ void Index::search(Option<uint32_t> & outcome, std::string query, const std::vecdelete [] filter_ids;delete [] all_result_ids;- long long int timeMillis = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - begin).count();+ //long long int timeMillis = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - begin).count();//!std::cout << "Time taken for result calc: " << timeMillis << "us" << std::endl;outcome = Option<uint32_t>(field_order_kvs.size());@@ -627,7 +626,7 @@ void Index::search_field(std::string & query, const std::string & field, uint32_std::vector<std::string> tokens;StringUtils::split(query, tokens, " ");- const int max_cost = (num_typos < 0 || num_typos > 2) ? 2 : num_typos;+ const size_t max_cost = (num_typos < 0 || num_typos > 2) ? 2 : num_typos;const size_t max_results = Index::SEARCH_LIMIT_NUM;size_t total_results = topster.size;@@ -661,7 +660,7 @@ void Index::search_field(std::string & query, const std::string & field, uint32_// stores candidates for each token, i.e. i-th index would have all possible tokens with a cost of "c"std::vector<token_candidates> token_candidates_vec;- const size_t combination_limit = 10;+ const long long combination_limit = 10;auto product = []( long long a, std::vector<int>& b ) { return a*b.size(); };long long n = 0;long long int N = std::accumulate(token_to_costs.begin(), token_to_costs.end(), 1LL, product);@@ -677,7 +676,7 @@ void Index::search_field(std::string & query, const std::string & field, uint32_}token_candidates_vec.clear();- int token_index = 0;+ size_t token_index = 0;while(token_index < tokens.size()) {// For each token, look up the generated cost for this iteration and search using that cost@@ -692,7 +691,7 @@ void Index::search_field(std::string & query, const std::string & field, uint32_} else {// prefix should apply only for last tokenconst bool prefix_search = prefix && ((token_index == tokens.size()-1) ? true : false);- const int token_len = prefix_search ? (int) token.length() : (int) token.length() + 1;+ const size_t token_len = prefix_search ? (int) token.length() : (int) token.length() + 1;// If this is a prefix search, we should for more candidates and do a union of those document IDsconst int max_candidates = prefix_search ? 10 : 3;@@ -776,7 +775,7 @@ void Index::search_field(std::string & query, const std::string & field, uint32_void Index::log_leaves(const int cost, const std::string &token, const std::vector<art_leaf *> &leaves) const {printf("Token: %s, cost: %d, candidates: \n", token.c_str(), cost);- for(auto i=0; i < leaves.size(); i++) {+ for(size_t i=0; i < leaves.size(); i++) {printf("%.*s, ", leaves[i]->key_len, leaves[i]->key);printf("frequency: %d, max_score: %d\n", leaves[i]->values->ids.getLength(), leaves[i]->max_score);/*for(auto j=0; j<leaves[i]->values->ids.getLength(); j++) {@@ -847,7 +846,7 @@ void Index::score_results(const std::vector<sort_by> & sort_fields, const int &((int64_t)(255 - total_cost) << 16) |((int64_t)(MAX_SEARCH_TOKENS - single_token_match.distance));- for(auto i=0; i<result_size; i++) {+ for(size_t i=0; i<result_size; i++) {const uint32_t seq_id = result_ids[i];uint64_t match_score = 0;@@ -906,7 +905,7 @@ void Index::populate_token_positions(const std::vector<art_leaf *> &query_sugges// for each token in the query, find the positions that it appears in this documentfor (const art_leaf *token_leaf : query_suggestion) {std::vector<uint16_t> positions;- int doc_index = leaf_to_indices.at(token_leaf)[result_index];+ uint32_t doc_index = leaf_to_indices.at(token_leaf)[result_index];if(doc_index == token_leaf->values->ids.getLength()) {continue;}@@ -931,7 +930,7 @@ inline std::vector<art_leaf *> Index::next_suggestion(const std::vector<token_ca// generate the next combination from `token_leaves` and store it in `query_suggestion`ldiv_t q { n, 0 };- for(long long i = 0 ; i < token_candidates_vec.size(); i++) {+ for(long long i = 0 ; i < (long long) token_candidates_vec.size(); i++) {q = ldiv(q.quot, token_candidates_vec[i].candidates.size());query_suggestion[i] = token_candidates_vec[i].candidates[q.rem];}diff --git a/test/collection_test.cpp b/test/collection_test.cppindex 7992a40a..b939792e 100644--- a/test/collection_test.cpp+++ b/test/collection_test.cpp@@ -5,7 +5,6 @@#include <algorithm>#include <collection_manager.h>#include "collection.h"-#include "person.h"#include "number.h"class CollectionTest : public ::testing::Test {diff --git a/test/sorted_array_test.cpp b/test/sorted_array_test.cppindex 26bfa9c6..dfdb9dcc 100644--- a/test/sorted_array_test.cpp+++ b/test/sorted_array_test.cpp@@ -110,7 +110,7 @@ TEST(SortedArrayTest, BulkIndexOf) {uint32_t *results = new uint32_t[search_ids.size()];ids.indexOf(&search_ids[0], search_ids.size(), results);- for(auto i = 0; i < search_ids.size(); i++) {+ for(size_t i = 0; i < search_ids.size(); i++) {auto search_id = search_ids.at(i);ASSERT_EQ(ids.indexOf(search_id), results[i]);}@@ -125,7 +125,7 @@ TEST(SortedArrayTest, BulkIndexOf) {ids.indexOf(&search_ids[0], search_ids.size(), results);- for(auto i = 0; i < search_ids.size(); i++) {+ for(size_t i = 0; i < search_ids.size(); i++) {auto search_id = search_ids.at(i);ASSERT_EQ(ids.indexOf(search_id), results[i]);}diff --git a/test/topster_test.cpp b/test/topster_test.cppindex 8f4ed1d3..f09f0417 100644--- a/test/topster_test.cpp+++ b/test/topster_test.cpp@@ -37,7 +37,7 @@ TEST(TopsterTest, StoreMaxIntValuesWithoutRepetition) {std::vector<uint64_t> ids = {4, 1, 5, 8, 9};- for(int i = 0; i < topster.size; i++) {+ for(uint32_t i = 0; i < topster.size; i++) {EXPECT_EQ(ids[i], topster.getKeyAt(i));}}@@ -75,7 +75,7 @@ TEST(TopsterTest, StoreMaxFloatValuesWithoutRepetition) {std::vector<uint64_t> ids = {4, 1, 5, 8, 9};- for(int i = 0; i < topster.size; i++) {+ for(uint32_t i = 0; i < topster.size; i++) {EXPECT_EQ(ids[i], topster.getKeyAt(i));}}\ No newline at end of file