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

Change map ds for sort aggregation.

Kishore Nallan99721213ec45
diff --git a/include/field.h b/include/field.h
index aad0bce8..6b4c7418 100644
--- a/include/field.h
+++ b/include/field.h
@@ -545,12 +545,12 @@ struct token_pos_cost_t {
};
struct facet_count_t {
- uint32_t count;
+ uint32_t count = 0;
spp::sparse_hash_set<uint64_t> groups; // used for faceting grouped results
// used to fetch the actual document and value for representation
- uint32_t doc_id;
- uint32_t array_pos;
+ uint32_t doc_id = 0;
+ uint32_t array_pos = 0;
std::vector<std::string> tokens;
};
diff --git a/include/topster.h b/include/topster.h
index 19ba746c..f86a7b4b 100644
--- a/include/topster.h
+++ b/include/topster.h
@@ -4,7 +4,7 @@
#include <climits>
#include <cstdio>
#include <algorithm>
-#include <sparsepp.h>
+#include <unordered_map>
struct KV {
uint8_t field_id{};
@@ -106,9 +106,9 @@ struct Topster {
KV** kvs;
// For distinct, stores the min heap kv of each group_kv_map topster value
- spp::sparse_hash_map<uint64_t, KV*> kv_map;
+ std::unordered_map<uint64_t, KV*> kv_map;
- spp::sparse_hash_map<uint64_t, Topster*> group_kv_map;
+ std::unordered_map<uint64_t, Topster*> group_kv_map;
size_t distinct;
explicit Topster(size_t capacity): Topster(capacity, 0) {
diff --git a/src/index.cpp b/src/index.cpp
index 94993f10..22341a8f 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -927,11 +927,6 @@ void Index::do_facets(std::vector<facet> & facets, facet_query_t & facet_query,
}
if(!use_facet_query || fquery_hashes.find(fhash) != fquery_hashes.end()) {
- if(a_facet.result_map.count(fhash) == 0) {
- a_facet.result_map.emplace(fhash, facet_count_t{0, spp::sparse_hash_set<uint64_t>(),
- doc_seq_id, 0, {}});
- }
-
facet_count_t& facet_count = a_facet.result_map[fhash];
//LOG(INFO) << "field: " << a_facet.field_name << ", doc id: " << doc_seq_id << ", hash: " << fhash;