mirror of
https://github.com/typesense/typesense.git
synced 2025-05-21 14:12:27 +08:00
refactoring lookup map
This commit is contained in:
parent
f4fca28622
commit
96f9304ce1
@ -109,7 +109,7 @@ private:
|
||||
|
||||
// field -> facet_index
|
||||
std::unordered_map<std::string, facet_doc_ids_list_t> facet_field_map;
|
||||
std::unordered_map<uint32_t, int64_t> index_to_int64_map;
|
||||
spp::sparse_hash_map<uint32_t, int64_t> fhash_to_int64_map;
|
||||
// auto incrementing ID that is assigned to each unique facet value string
|
||||
uint32_t next_facet_id = 0;
|
||||
|
||||
|
@ -40,7 +40,7 @@ void facet_index_t::insert(const std::string& field_name,std::unordered_map<face
|
||||
|
||||
if(!is_string_field) {
|
||||
int64_t val = std::stoll(fvalue.facet_value);
|
||||
index_to_int64_map[facet_id] = val;
|
||||
fhash_to_int64_map[facet_id] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,9 +341,9 @@ posting_list_t* facet_index_t::get_facet_hash_index(const std::string &field_nam
|
||||
}
|
||||
|
||||
int64_t facet_index_t::get_facet_val(uint32_t index) {
|
||||
auto it = index_to_int64_map.find(index);
|
||||
auto it = fhash_to_int64_map.find(index);
|
||||
|
||||
if(it != index_to_int64_map.end()) {
|
||||
if(it != fhash_to_int64_map.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user