diff --git a/internal/core/src/query/deprecated/ValidationUtil.cpp b/internal/core/src/query/deprecated/ValidationUtil.cpp index 4c10b36fdc..ad83769625 100644 --- a/internal/core/src/query/deprecated/ValidationUtil.cpp +++ b/internal/core/src/query/deprecated/ValidationUtil.cpp @@ -201,7 +201,6 @@ ValidateVectorIndexType(std::string& index_type, bool is_binary) { knowhere::IndexEnum::INDEX_FAISS_IVFPQ, knowhere::IndexEnum::INDEX_FAISS_IVFSQ8, knowhere::IndexEnum::INDEX_HNSW, - knowhere::IndexEnum::INDEX_ANNOY, }; static std::set s_binary_index_types = { @@ -335,12 +334,6 @@ ValidateIndexParams(const milvus::json& index_params, if (!status.ok()) { return status; } - } else if (index_type == knowhere::IndexEnum::INDEX_ANNOY) { - auto status = CheckParameterRange( - index_params, knowhere::IndexParams::n_trees, 1, 1024); - if (!status.ok()) { - return status; - } } return Status::OK(); diff --git a/internal/core/src/query/visitors/VerifyPlanNodeVisitor.cpp b/internal/core/src/query/visitors/VerifyPlanNodeVisitor.cpp index 5536f92795..bd3fa0b6fb 100644 --- a/internal/core/src/query/visitors/VerifyPlanNodeVisitor.cpp +++ b/internal/core/src/query/visitors/VerifyPlanNodeVisitor.cpp @@ -30,15 +30,12 @@ static IndexType InferIndexType(const Json& search_params) { // ivf -> nprobe // hnsw -> ef - // annoy -> search_k - // ngtpanng / ngtonng -> max_search_edges / epsilon static const std::map key_list = [] { std::map list; namespace ip = knowhere::indexparam; namespace ie = knowhere::IndexEnum; list.emplace(ip::NPROBE, ie::INDEX_FAISS_IVFFLAT); list.emplace(ip::EF, ie::INDEX_HNSW); - list.emplace(ip::SEARCH_K, ie::INDEX_ANNOY); return list; }(); auto dbg_str = search_params.dump(); diff --git a/internal/core/unittest/test_index_wrapper.cpp b/internal/core/unittest/test_index_wrapper.cpp index 8ec10e3f14..86ed06447e 100644 --- a/internal/core/unittest/test_index_wrapper.cpp +++ b/internal/core/unittest/test_index_wrapper.cpp @@ -54,7 +54,6 @@ class IndexWrapperTest : public ::testing::TestWithParam { {knowhere::IndexEnum::INDEX_FAISS_BIN_IVFFLAT, true}, {knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP, true}, {knowhere::IndexEnum::INDEX_HNSW, false}, - {knowhere::IndexEnum::INDEX_ANNOY, false}, }; is_binary = is_binary_map[index_type]; @@ -115,8 +114,7 @@ INSTANTIATE_TEST_CASE_P( knowhere::metric::TANIMOTO), std::pair(knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP, knowhere::metric::JACCARD), - std::pair(knowhere::IndexEnum::INDEX_HNSW, knowhere::metric::L2), - std::pair(knowhere::IndexEnum::INDEX_ANNOY, knowhere::metric::L2))); + std::pair(knowhere::IndexEnum::INDEX_HNSW, knowhere::metric::L2))); TEST_P(IndexWrapperTest, BuildAndQuery) { auto index = milvus::indexbuilder::IndexFactory::GetInstance().CreateIndex( diff --git a/internal/core/unittest/test_indexing.cpp b/internal/core/unittest/test_indexing.cpp index a740bbcaba..43fe28be18 100644 --- a/internal/core/unittest/test_indexing.cpp +++ b/internal/core/unittest/test_indexing.cpp @@ -312,7 +312,6 @@ class IndexTest : public ::testing::TestWithParam { {knowhere::IndexEnum::INDEX_FAISS_BIN_IVFFLAT, true}, {knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP, true}, {knowhere::IndexEnum::INDEX_HNSW, false}, - {knowhere::IndexEnum::INDEX_ANNOY, false}, {knowhere::IndexEnum::INDEX_DISKANN, false}, }; @@ -374,12 +373,12 @@ INSTANTIATE_TEST_CASE_P( knowhere::metric::TANIMOTO), std::pair(knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP, knowhere::metric::JACCARD), - std::pair(knowhere::IndexEnum::INDEX_HNSW, knowhere::metric::L2), + std::pair(knowhere::IndexEnum::INDEX_HNSW, knowhere::metric::L2) // ci ut not start minio, so not run ut about diskann index for now // #ifdef BUILD_DISK_ANN - // std::pair(knowhere::IndexEnum::INDEX_DISKANN, knowhere::metric::L2), + // std::pair(knowhere::IndexEnum::INDEX_DISKANN, knowhere::metric::L2), // #endif - std::pair(knowhere::IndexEnum::INDEX_ANNOY, knowhere::metric::L2))); + )); TEST_P(IndexTest, BuildAndQuery) { milvus::index::CreateIndexInfo create_index_info; @@ -446,10 +445,8 @@ TEST_P(IndexTest, BuildAndQuery) { if (!is_binary) { EXPECT_EQ(result->seg_offsets_[0], query_offset); } - if (index_type != knowhere::IndexEnum::INDEX_ANNOY) { - search_info.search_params_ = range_search_conf; - vec_index->Query(xq_dataset, search_info, nullptr); - } + search_info.search_params_ = range_search_conf; + vec_index->Query(xq_dataset, search_info, nullptr); } // #ifdef BUILD_DISK_ANN diff --git a/internal/core/unittest/test_utils/indexbuilder_test_utils.h b/internal/core/unittest/test_utils/indexbuilder_test_utils.h index 146320381c..6989c3710a 100644 --- a/internal/core/unittest/test_utils/indexbuilder_test_utils.h +++ b/internal/core/unittest/test_utils/indexbuilder_test_utils.h @@ -241,12 +241,6 @@ generate_build_conf(const milvus::IndexType& index_type, {knowhere::indexparam::HNSW_M, "16"}, {knowhere::indexparam::EFCONSTRUCTION, "200"}, }; - } else if (index_type == knowhere::IndexEnum::INDEX_ANNOY) { - return knowhere::Json{ - {knowhere::meta::METRIC_TYPE, metric_type}, - {knowhere::meta::DIM, std::to_string(DIM)}, - {knowhere::indexparam::N_TREES, "4"}, - }; } else if (index_type == knowhere::IndexEnum::INDEX_DISKANN) { return knowhere::Json{ {knowhere::meta::METRIC_TYPE, metric_type}, @@ -298,8 +292,6 @@ generate_search_conf(const milvus::IndexType& index_type, conf[knowhere::indexparam::NPROBE] = 4; } else if (index_type == knowhere::IndexEnum::INDEX_HNSW) { conf[knowhere::indexparam::EF] = 200; - } else if (index_type == knowhere::IndexEnum::INDEX_ANNOY) { - conf[knowhere::indexparam::SEARCH_K] = 100; } else if (index_type == knowhere::IndexEnum::INDEX_DISKANN) { conf[milvus::index::DISK_ANN_QUERY_LIST] = K * 2; } @@ -326,8 +318,6 @@ generate_range_search_conf(const milvus::IndexType& index_type, conf[knowhere::indexparam::NPROBE] = 4; } else if (index_type == knowhere::IndexEnum::INDEX_HNSW) { conf[knowhere::indexparam::EF] = 200; - } else if (index_type == knowhere::IndexEnum::INDEX_ANNOY) { - conf[knowhere::indexparam::SEARCH_K] = 100; } else if (index_type == knowhere::IndexEnum::INDEX_DISKANN) { conf[milvus::index::DISK_ANN_QUERY_LIST] = K * 2; } diff --git a/internal/querynode/mock_test.go b/internal/querynode/mock_test.go index c02cb2192c..2889a09d0b 100644 --- a/internal/querynode/mock_test.go +++ b/internal/querynode/mock_test.go @@ -124,8 +124,7 @@ const ( IndexFaissBinIDMap = "BIN_FLAT" IndexFaissBinIVFFlat = "BIN_IVF_FLAT" - IndexHNSW = "HNSW" - IndexANNOY = "ANNOY" + IndexHNSW = "HNSW" // metric type L2 = "L2" @@ -140,9 +139,6 @@ const ( nprobe = 8 efConstruction = 200 ef = 200 - edgeSize = 10 - epsilon = 0.1 - maxSearchEdges = 50 ) // ---------- unittest util functions ---------- @@ -463,9 +459,6 @@ func genIndexParams(indexType, metricType string) (map[string]string, map[string indexParams["M"] = strconv.Itoa(16) indexParams["efConstruction"] = strconv.Itoa(efConstruction) //indexParams["ef"] = strconv.Itoa(ef) - } else if indexType == IndexANNOY { - indexParams["n_trees"] = strconv.Itoa(4) - indexParams["search_k"] = strconv.Itoa(100) } else if indexType == IndexFaissBinIVFFlat { // binary vector indexParams["nlist"] = strconv.Itoa(nlist) indexParams["m"] = strconv.Itoa(m) diff --git a/internal/util/indexparamcheck/conf_adapter.go b/internal/util/indexparamcheck/conf_adapter.go index 8a2b6f46b5..ee613176a2 100644 --- a/internal/util/indexparamcheck/conf_adapter.go +++ b/internal/util/indexparamcheck/conf_adapter.go @@ -359,24 +359,7 @@ func newHNSWConfAdapter() *HNSWConfAdapter { return &HNSWConfAdapter{} } -// ANNOYConfAdapter checks if an ANNOY index can be built. -type ANNOYConfAdapter struct { - BaseConfAdapter -} - -// CheckTrain checks if an annoy index can be built with specific parameters. -func (adapter *ANNOYConfAdapter) CheckTrain(params map[string]string) bool { - if !CheckIntByRange(params, NTREES, MinNTrees, MaxNTrees) { - return false - } - - return adapter.BaseConfAdapter.CheckTrain(params) -} - -func newANNOYConfAdapter() *ANNOYConfAdapter { - return &ANNOYConfAdapter{} -} - +// DISKANNConfAdapter checks if an diskann index can be built. type DISKANNConfAdapter struct { BaseConfAdapter } diff --git a/internal/util/indexparamcheck/conf_adapter_mgr.go b/internal/util/indexparamcheck/conf_adapter_mgr.go index 831e3c8eda..64a98809a1 100644 --- a/internal/util/indexparamcheck/conf_adapter_mgr.go +++ b/internal/util/indexparamcheck/conf_adapter_mgr.go @@ -55,7 +55,6 @@ func (mgr *ConfAdapterMgrImpl) registerConfAdapter() { mgr.adapters[IndexFaissBinIDMap] = newBinIDMAPConfAdapter() mgr.adapters[IndexFaissBinIvfFlat] = newBinIVFConfAdapter() mgr.adapters[IndexHNSW] = newHNSWConfAdapter() - mgr.adapters[IndexANNOY] = newANNOYConfAdapter() mgr.adapters[IndexDISKANN] = newDISKANNConfAdapter() } diff --git a/internal/util/indexparamcheck/conf_adapter_mgr_test.go b/internal/util/indexparamcheck/conf_adapter_mgr_test.go index 305f501693..22da07b96a 100644 --- a/internal/util/indexparamcheck/conf_adapter_mgr_test.go +++ b/internal/util/indexparamcheck/conf_adapter_mgr_test.go @@ -70,12 +70,6 @@ func Test_GetConfAdapterMgrInstance(t *testing.T) { assert.NotEqual(t, nil, adapter) _, ok = adapter.(*HNSWConfAdapter) assert.Equal(t, true, ok) - - adapter, err = adapterMgr.GetAdapter(IndexANNOY) - assert.Equal(t, nil, err) - assert.NotEqual(t, nil, adapter) - _, ok = adapter.(*ANNOYConfAdapter) - assert.Equal(t, true, ok) } func TestConfAdapterMgrImpl_GetAdapter(t *testing.T) { @@ -130,12 +124,6 @@ func TestConfAdapterMgrImpl_GetAdapter(t *testing.T) { assert.NotEqual(t, nil, adapter) _, ok = adapter.(*HNSWConfAdapter) assert.Equal(t, true, ok) - - adapter, err = adapterMgr.GetAdapter(IndexANNOY) - assert.Equal(t, nil, err) - assert.NotEqual(t, nil, adapter) - _, ok = adapter.(*ANNOYConfAdapter) - assert.Equal(t, true, ok) } func TestConfAdapterMgrImpl_GetAdapter_multiple_threads(t *testing.T) { diff --git a/internal/util/indexparamcheck/conf_adapter_test.go b/internal/util/indexparamcheck/conf_adapter_test.go index 7fc6204a08..7c4400a10c 100644 --- a/internal/util/indexparamcheck/conf_adapter_test.go +++ b/internal/util/indexparamcheck/conf_adapter_test.go @@ -375,37 +375,7 @@ func TestHNSWConfAdapter_CheckTrain(t *testing.T) { } } -// ANNOYConfAdapter checks if an annoy index can be built -func TestANNOYConfAdapter_CheckTrain(t *testing.T) { - validParams := map[string]string{ - DIM: strconv.Itoa(128), - NTREES: strconv.Itoa(4), - Metric: L2, - } - - invalidTreeParamsMin := copyParams(validParams) - invalidTreeParamsMin[NTREES] = strconv.Itoa(MinNTrees - 1) - - invalidTreeParamsMax := copyParams(validParams) - invalidTreeParamsMax[NTREES] = strconv.Itoa(MaxNTrees + 1) - - cases := []struct { - params map[string]string - want bool - }{ - {validParams, true}, - {invalidTreeParamsMin, false}, - {invalidTreeParamsMax, false}, - } - - adapter := newANNOYConfAdapter() - for _, test := range cases { - if got := adapter.CheckTrain(test.params); got != test.want { - t.Errorf("ANNOYConfAdapter.CheckTrain(%v) = %v", test.params, test.want) - } - } -} - +// DISKANNConfAdapter checks if an diskann index can be built func TestDiskAnnConfAdapter_CheckTrain(t *testing.T) { validParams := map[string]string{ DIM: strconv.Itoa(128), diff --git a/internal/util/indexparamcheck/index_type.go b/internal/util/indexparamcheck/index_type.go index 85e4278dee..fc4cd723e2 100644 --- a/internal/util/indexparamcheck/index_type.go +++ b/internal/util/indexparamcheck/index_type.go @@ -25,6 +25,5 @@ const ( IndexFaissBinIDMap IndexType = "BIN_FLAT" IndexFaissBinIvfFlat IndexType = "BIN_IVF_FLAT" IndexHNSW IndexType = "HNSW" - IndexANNOY IndexType = "ANNOY" IndexDISKANN IndexType = "DISKANN" ) diff --git a/tests/python_client/deploy/common.py b/tests/python_client/deploy/common.py index 1b938b97a2..98b8dd1e68 100644 --- a/tests/python_client/deploy/common.py +++ b/tests/python_client/deploy/common.py @@ -1,10 +1,10 @@ import json from utils.util_log import test_log as log -all_index_types = ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_PQ", "HNSW", "ANNOY", "BIN_FLAT", "BIN_IVF_FLAT"] +all_index_types = ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_PQ", "HNSW", "BIN_FLAT", "BIN_IVF_FLAT"] default_index_params = [{"nlist": 128}, {"nlist": 128}, {"nlist": 128}, {"nlist": 128, "m": 16, "nbits": 8}, - {"M": 48, "efConstruction": 500}, {"n_trees": 50}, {"nlist": 128}, {"nlist": 128}] + {"M": 48, "efConstruction": 500}, {"nlist": 128}, {"nlist": 128}] index_params_map = dict(zip(all_index_types, default_index_params)) diff --git a/tests/python_client/deploy/scripts/utils.py b/tests/python_client/deploy/scripts/utils.py index 1370a93739..9042e36fc7 100644 --- a/tests/python_client/deploy/scripts/utils.py +++ b/tests/python_client/deploy/scripts/utils.py @@ -16,10 +16,10 @@ logger.add(sys.stderr, format= "{time:YYYY-MM-DD HH:mm:ss.SSS} | pymilvus_version = pymilvus.__version__ -all_index_types = ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_PQ", "HNSW", "ANNOY"] +all_index_types = ["FLAT", "IVF_FLAT", "IVF_SQ8", "IVF_PQ", "HNSW"] default_index_params = [{}, {"nlist": 128}, {"nlist": 128}, {"nlist": 128, "m": 16, "nbits": 8}, - {"M": 48, "efConstruction": 500}, {"n_trees": 50}] + {"M": 48, "efConstruction": 500}] index_params_map = dict(zip(all_index_types, default_index_params)) diff --git a/tests/python_client/utils/util_pymilvus.py b/tests/python_client/utils/util_pymilvus.py index 34e475462b..5b58ca54b6 100644 --- a/tests/python_client/utils/util_pymilvus.py +++ b/tests/python_client/utils/util_pymilvus.py @@ -39,7 +39,6 @@ all_index_types = [ "IVF_SQ8", "IVF_PQ", "HNSW", - "ANNOY", "BIN_FLAT", "BIN_IVF_FLAT" ] @@ -50,7 +49,6 @@ default_index_params = [ {"nlist": 128}, {"nlist": 128, "m": 16, "nbits": 8}, {"M": 48, "efConstruction": 500}, - {"n_trees": 50}, {"nlist": 128}, {"nlist": 128} ]