chore: some optimize in ivf index (#528)

This commit is contained in:
ZeFeng Yin
2026-07-14 10:55:51 +08:00
committed by GitHub
parent 1f51210ad4
commit f9ef15a362
4 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ int IVFDumper::dump_inverted_block(uint32_t inverted_list_id,
std::copy(keys, keys + vector_count, std::back_inserter(keys_));
++inverted_lists_meta_[cur_list_id_].block_count;
++header_.block_count;
header_.inverted_body_size += size;
header_.inverted_body_size += size + pd_size;
} else {
size_t step_size = meta_.element_size();
if (column_major) {
+2 -2
View File
@@ -644,7 +644,7 @@ int IVFEntity::search(size_t inverted_list_id, const void *query,
ailego_assert_with(block_vecs < sizeof(keeps) * 8, "bits overflow");
for (size_t k = 0; k < vecs_count; ++k) {
if (!filter(block_keys[k])) {
keeps |= (1 << k);
keeps |= (1ULL << k);
} else {
++(*context_stats->mutable_filtered_count());
}
@@ -661,7 +661,7 @@ int IVFEntity::search(size_t inverted_list_id, const void *query,
uint32_t id_off = list_meta->id_offset + (i + b) * block_vecs;
for (size_t k = 0; k < vecs_count; ++k) {
if (keeps & (1 << k)) {
if (keeps & (1ULL << k)) {
if (block_keys[k] != kInvalidKey) {
heap->emplace(block_keys[k], distances[k] * norm_val, id_off + k);
}
+1 -1
View File
@@ -233,7 +233,7 @@ class IVFEntity {
return this->convert_to_normalize_value(scale);
}
return norm_value_;
return 1.0f;
}
//! Check whether the feature segment exist
+3
View File
@@ -108,6 +108,9 @@ int IVFStreamer::open(IndexStorage::Pointer storage) {
stats_.set_loaded_count(entity_->vector_count());
stats_.set_loaded_costtime(timer.milli_seconds());
LOG_INFO("IVFStreamer open done, vector_count=%zu, inverted_list_count=%zu",
entity_->vector_count(), entity_->inverted_list_count());
searcher_state_ = STATE_LOADED;
return 0;
}