From b36a524739f52dfd25128a60c0b81642b55477fd Mon Sep 17 00:00:00 2001 From: Xu Peng Date: Tue, 7 May 2019 15:21:39 +0800 Subject: [PATCH] refactor(db): using traits Former-commit-id: 6496aa13a3ba40d4bec2e32a1ad6f10377055775 --- cpp/src/db/FaissExecutionEngine.cpp | 7 ++----- cpp/src/db/Traits.cpp | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cpp/src/db/FaissExecutionEngine.cpp b/cpp/src/db/FaissExecutionEngine.cpp index 76847705d3..cc0f1046d6 100644 --- a/cpp/src/db/FaissExecutionEngine.cpp +++ b/cpp/src/db/FaissExecutionEngine.cpp @@ -21,13 +21,10 @@ namespace zilliz { namespace vecwise { namespace engine { -const std::string RawIndexType = "IDMap,Flat"; -const std::string BuildIndexType = "IVF"; // IDMap / IVF - template FaissExecutionEngine::FaissExecutionEngine(uint16_t dimension, const std::string& location) - : pIndex_(faiss::index_factory(dimension, RawIndexType.c_str())), + : pIndex_(faiss::index_factory(dimension, IndexTrait::RawIndexType)), location_(location) { } @@ -97,7 +94,7 @@ typename FaissExecutionEngine::Ptr FaissExecutionEngine::BuildIndex(const std::string& location) { auto opd = std::make_shared(); opd->d = pIndex_->d; - opd->index_type = BuildIndexType; + opd->index_type = IndexTrait::BuildIndexType; IndexBuilderPtr pBuilder = GetIndexBuilder(opd); auto from_index = dynamic_cast(pIndex_.get()); diff --git a/cpp/src/db/Traits.cpp b/cpp/src/db/Traits.cpp index 0d900b9212..a30b9fc036 100644 --- a/cpp/src/db/Traits.cpp +++ b/cpp/src/db/Traits.cpp @@ -3,6 +3,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. * Proprietary and confidential. ******************************************************************************/ +#include "Traits.h" namespace zilliz { namespace vecwise {