From 10579c2e1e89c12d2a79ccea0ba6c6a3a6fc2761 Mon Sep 17 00:00:00 2001 From: "xianliang.li" Date: Wed, 18 Dec 2024 21:52:01 +0800 Subject: [PATCH] revert hnsw to hnswlib Signed-off-by: xianliang.li --- src/index/hnsw/faiss_hnsw.cc | 24 ++++++++++++------------ src/index/hnsw/hnsw.cc | 8 ++++++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/index/hnsw/faiss_hnsw.cc b/src/index/hnsw/faiss_hnsw.cc index 1e89942ba..b52fa00ef 100644 --- a/src/index/hnsw/faiss_hnsw.cc +++ b/src/index/hnsw/faiss_hnsw.cc @@ -2272,21 +2272,21 @@ class BaseFaissRegularIndexHNSWPRQNodeTemplate : public BaseFaissRegularIndexHNS } }; -// MV is only for compatibility -#ifdef KNOWHERE_WITH_CARDINAL -KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW_DEPRECATED, - BaseFaissRegularIndexHNSWFlatNodeTemplateWithSearchFallback, - knowhere::feature::MMAP | knowhere::feature::MV) -#else -KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW, BaseFaissRegularIndexHNSWFlatNodeTemplateWithSearchFallback, - knowhere::feature::MMAP | knowhere::feature::MV) -#endif +//// MV is only for compatibility +// #ifdef KNOWHERE_WITH_CARDINAL +// KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW_DEPRECATED, +// BaseFaissRegularIndexHNSWFlatNodeTemplateWithSearchFallback, +// knowhere::feature::MMAP | knowhere::feature::MV) +// #else +// KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW, BaseFaissRegularIndexHNSWFlatNodeTemplateWithSearchFallback, +// knowhere::feature::MMAP | knowhere::feature::MV) +// #endif KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW_SQ, BaseFaissRegularIndexHNSWSQNodeTemplate, - knowhere::feature::MMAP) + knowhere::feature::NONE) KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW_PQ, BaseFaissRegularIndexHNSWPQNodeTemplate, - knowhere::feature::MMAP) + knowhere::feature::NONE) KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW_PRQ, BaseFaissRegularIndexHNSWPRQNodeTemplate, - knowhere::feature::MMAP) + knowhere::feature::NONE) } // namespace knowhere diff --git a/src/index/hnsw/hnsw.cc b/src/index/hnsw/hnsw.cc index 15f3213b6..17d4034c6 100644 --- a/src/index/hnsw/hnsw.cc +++ b/src/index/hnsw/hnsw.cc @@ -36,7 +36,11 @@ template class HnswIndexNode; template class HnswIndexNode; template class HnswIndexNode; -KNOWHERE_SIMPLE_REGISTER_DENSE_ALL_GLOBAL(HNSWLIB_DEPRECATED, HnswIndexNode, - knowhere::feature::MMAP | knowhere::feature::MV) +#ifdef KNOWHERE_WITH_CARDINAL +KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW_DEPRECATED, HnswIndexNode, + knowhere::feature::MMAP | knowhere::feature::MV) +#else +KNOWHERE_SIMPLE_REGISTER_DENSE_FLOAT_ALL_GLOBAL(HNSW, HnswIndexNode, knowhere::feature::MMAP | knowhere::feature::MV) +#endif } // namespace knowhere