diff --git a/mxIndex/TestAscendIndexIVFSP.cpp b/mxIndex/TestAscendIndexIVFSP.cpp index f86ced1eafcd04e019dc44f213ae7b87b5bdc085..2d96026454e3638ccf14b989efa946fe45dfa2b9 100644 --- a/mxIndex/TestAscendIndexIVFSP.cpp +++ b/mxIndex/TestAscendIndexIVFSP.cpp @@ -464,10 +464,17 @@ void MultiSearchAndMultiSearchFilter() std::vector indexes; for (int i = 0; i < INDEX_NUM; ++i) { - auto index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, - codeBookPath.c_str(), - faiss::ScalarQuantizer::QuantizerType::QT_8bit, - faiss::MetricType::METRIC_L2, conf); + faiss::ascend::AscendIndexIVFSP* index; + if (i == 0) { + index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, + codeBookPath.c_str(), faiss::ScalarQuantizer::QuantizerType::QT_8bit, + faiss::MetricType::METRIC_L2, conf); + } else { + index = new faiss::ascend::AscendIndexIVFSP(dim, nonzeroNum, nlist, + *(faiss::ascend::AscendIndexIVFSP*)indexes[0], faiss::ScalarQuantizer::QuantizerType::QT_8bit, + faiss::MetricType::METRIC_L2, conf); + } + index->setVerbose(true); indexes.emplace_back(index); printf("create index:%d\n", i);