mirror of https://github.com/milvus-io/milvus.git
Fix IVF_FLAT index's wrong meta_data (#7167)
Signed-off-by: xige-16 <xi.ge@zilliz.com>pull/7160/merge
parent
3cc210da26
commit
76066b5659
|
@ -78,6 +78,15 @@ Assemble(BinarySet& binarySet) {
|
|||
void
|
||||
Disassemble(const int64_t& slice_size_in_byte, BinarySet& binarySet) {
|
||||
milvus::json meta_info;
|
||||
auto slice_meta = binarySet.Erase(INDEX_FILE_SLICE_META);
|
||||
if (slice_meta != nullptr) {
|
||||
milvus::json last_meta_data =
|
||||
milvus::json::parse(std::string(reinterpret_cast<char*>(slice_meta->data.get()), slice_meta->size));
|
||||
for (auto& item : last_meta_data[META]) {
|
||||
meta_info[META].emplace_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> slice_key_list;
|
||||
for (auto& kv : binarySet.binary_map_) {
|
||||
if (kv.second->size > slice_size_in_byte) {
|
||||
|
|
|
@ -278,6 +278,7 @@ TEST(IVFFLATNMWrapper, Build) {
|
|||
}
|
||||
|
||||
TEST(IVFFLATNMWrapper, Codec) {
|
||||
int64_t flat_nb = 1000000;
|
||||
auto index_type = milvus::knowhere::IndexEnum::INDEX_FAISS_IVFFLAT;
|
||||
auto metric_type = milvus::knowhere::Metric::L2;
|
||||
indexcgo::TypeParams type_params;
|
||||
|
@ -289,9 +290,9 @@ TEST(IVFFLATNMWrapper, Codec) {
|
|||
assert(ok);
|
||||
ok = google::protobuf::TextFormat::PrintToString(index_params, &index_params_str);
|
||||
assert(ok);
|
||||
auto dataset = GenDataset(NB, metric_type, false);
|
||||
auto dataset = GenDataset(flat_nb, metric_type, false);
|
||||
auto xb_data = dataset.get_col<float>(0);
|
||||
auto xb_dataset = milvus::knowhere::GenDataset(NB, DIM, xb_data.data());
|
||||
auto xb_dataset = milvus::knowhere::GenDataset(flat_nb, DIM, xb_data.data());
|
||||
auto index =
|
||||
std::make_unique<milvus::indexbuilder::IndexWrapper>(type_params_str.c_str(), index_params_str.c_str());
|
||||
ASSERT_NO_THROW(index->BuildWithoutIds(xb_dataset));
|
||||
|
|
Loading…
Reference in New Issue