feat(db): add some print

Former-commit-id: 200b365c40532a13d777457bd53e6788fd613559
This commit is contained in:
Xu Peng 2019-04-19 19:00:29 +08:00
parent d003ed2af4
commit b377266934

View File

@ -255,13 +255,18 @@ Status DBImpl::build_index(const meta::GroupFileSchema& file) {
}
auto opd = std::make_shared<Operand>();
opd->d = file.dimension;
opd->index_type = "IDMap,Flat";
IndexBuilderPtr pBuilder = GetIndexBuilder(opd);
auto from_index = dynamic_cast<faiss::IndexIDMap*>(faiss::read_index(file.location.c_str()));
std::cout << "Preparing build_index for file_id=" << file.file_id
<< " with new index_file_id=" << group_file.file_id << std::endl;
auto index = pBuilder->build_all(from_index->ntotal,
dynamic_cast<faiss::IndexFlat*>(from_index->index)->xb.data(),
from_index->id_map.data());
std::cout << "Ending build_index for file_id=" << file.file_id
<< " with new index_file_id=" << group_file.file_id << std::endl;
/* std::cout << "raw size=" << from_index->ntotal << " index size=" << index->ntotal << std::endl; */
write_index(index, group_file.location.c_str());
group_file.file_type = meta::GroupFileSchema::INDEX;