EngineFactory.cpp 1.3 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6 7 8 9
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#include "EngineFactory.h"
#include "FaissExecutionEngine.h"
#include "Log.h"

Y
yu yunfeng 已提交
10

G
groot 已提交
11
namespace zilliz {
J
jinhai 已提交
12
namespace milvus {
G
groot 已提交
13 14 15 16
namespace engine {

ExecutionEnginePtr
EngineFactory::Build(uint16_t dimension,
Y
yu yunfeng 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
                     const std::string &location,
                     EngineType type) {

    ExecutionEnginePtr execution_engine_ptr;

    switch (type) {
        case EngineType::FAISS_IDMAP: {
            execution_engine_ptr =
                ExecutionEnginePtr(new FaissExecutionEngine(dimension, location, "IDMap", "IDMap,Flat"));
            break;
        }

        case EngineType::FAISS_IVFFLAT: {
            execution_engine_ptr =
                ExecutionEnginePtr(new FaissExecutionEngine(dimension, location, "IVF", "IDMap,Flat"));
            break;
        }

        default: {
            ENGINE_LOG_ERROR << "Unsupported engine type";
G
groot 已提交
37
            return nullptr;
Y
yu yunfeng 已提交
38
        }
G
groot 已提交
39
    }
Y
yu yunfeng 已提交
40 41 42

    execution_engine_ptr->Init();
    return execution_engine_ptr;
G
groot 已提交
43 44 45 46 47
}

}
}
}