mirror of https://github.com/milvus-io/milvus.git
refactor(db): using traits
Former-commit-id: 6496aa13a3ba40d4bec2e32a1ad6f10377055775pull/191/head
parent
9e43c45de4
commit
b36a524739
|
@ -21,13 +21,10 @@ namespace zilliz {
|
||||||
namespace vecwise {
|
namespace vecwise {
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
const std::string RawIndexType = "IDMap,Flat";
|
|
||||||
const std::string BuildIndexType = "IVF"; // IDMap / IVF
|
|
||||||
|
|
||||||
|
|
||||||
template<class IndexTrait>
|
template<class IndexTrait>
|
||||||
FaissExecutionEngine<IndexTrait>::FaissExecutionEngine(uint16_t dimension, const std::string& location)
|
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) {
|
location_(location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +94,7 @@ typename FaissExecutionEngine<IndexTrait>::Ptr
|
||||||
FaissExecutionEngine<IndexTrait>::BuildIndex(const std::string& location) {
|
FaissExecutionEngine<IndexTrait>::BuildIndex(const std::string& location) {
|
||||||
auto opd = std::make_shared<Operand>();
|
auto opd = std::make_shared<Operand>();
|
||||||
opd->d = pIndex_->d;
|
opd->d = pIndex_->d;
|
||||||
opd->index_type = BuildIndexType;
|
opd->index_type = IndexTrait::BuildIndexType;
|
||||||
IndexBuilderPtr pBuilder = GetIndexBuilder(opd);
|
IndexBuilderPtr pBuilder = GetIndexBuilder(opd);
|
||||||
|
|
||||||
auto from_index = dynamic_cast<faiss::IndexIDMap*>(pIndex_.get());
|
auto from_index = dynamic_cast<faiss::IndexIDMap*>(pIndex_.get());
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||||
* Proprietary and confidential.
|
* Proprietary and confidential.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#include "Traits.h"
|
||||||
|
|
||||||
namespace zilliz {
|
namespace zilliz {
|
||||||
namespace vecwise {
|
namespace vecwise {
|
||||||
|
|
Loading…
Reference in New Issue