refactor(db): using traits

Former-commit-id: 6496aa13a3ba40d4bec2e32a1ad6f10377055775
pull/191/head
Xu Peng 2019-05-07 15:21:39 +08:00
parent 9e43c45de4
commit b36a524739
2 changed files with 3 additions and 5 deletions

View File

@ -21,13 +21,10 @@ namespace zilliz {
namespace vecwise {
namespace engine {
const std::string RawIndexType = "IDMap,Flat";
const std::string BuildIndexType = "IVF"; // IDMap / IVF
template<class IndexTrait>
FaissExecutionEngine<IndexTrait>::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<IndexTrait>::Ptr
FaissExecutionEngine<IndexTrait>::BuildIndex(const std::string& location) {
auto opd = std::make_shared<Operand>();
opd->d = pIndex_->d;
opd->index_type = BuildIndexType;
opd->index_type = IndexTrait::BuildIndexType;
IndexBuilderPtr pBuilder = GetIndexBuilder(opd);
auto from_index = dynamic_cast<faiss::IndexIDMap*>(pIndex_.get());

View File

@ -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 {