未验证 提交 4cb83837 编写于 作者: C Cai Yudong 提交者: GitHub

move index type try2 (#2860)

* move EngineType and MetricType to MetaTypes.h
Signed-off-by: Nyudong.cai <yudong.cai@zilliz.com>

* move IndexType
Signed-off-by: Nyudong.cai <yudong.cai@zilliz.com>

* update changelog
Signed-off-by: Nyudong.cai <yudong.cai@zilliz.com>

* update changelog
Signed-off-by: Nyudong.cai <yudong.cai@zilliz.com>
上级 7bd60398
...@@ -41,6 +41,7 @@ Please mark all changes in change log and use the issue from GitHub ...@@ -41,6 +41,7 @@ Please mark all changes in change log and use the issue from GitHub
- \#2561 Clean util dependencies with other modules - \#2561 Clean util dependencies with other modules
- \#2612 Move all APIs in utils into namespace milvus - \#2612 Move all APIs in utils into namespace milvus
- \#2675 Print out system memory size when report invalid cpu cache size - \#2675 Print out system memory size when report invalid cpu cache size
- \#2841 Replace IndexType/EngineType/MetricType
## Task ## Task
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <faiss/utils/ConcurrentBitset.h> #include <faiss/utils/ConcurrentBitset.h>
#include "db/meta/MetaTypes.h"
#include "query/GeneralQuery.h" #include "query/GeneralQuery.h"
#include "utils/Json.h" #include "utils/Json.h"
#include "utils/Status.h" #include "utils/Status.h"
...@@ -32,67 +33,6 @@ using SearchJobPtr = std::shared_ptr<SearchJob>; ...@@ -32,67 +33,6 @@ using SearchJobPtr = std::shared_ptr<SearchJob>;
namespace engine { namespace engine {
// TODO(linxj): replace with VecIndex::IndexType
enum class EngineType {
INVALID = 0,
FAISS_IDMAP = 1,
FAISS_IVFFLAT,
FAISS_IVFSQ8,
NSG_MIX,
FAISS_IVFSQ8H,
FAISS_PQ,
SPTAG_KDT,
SPTAG_BKT,
FAISS_BIN_IDMAP,
FAISS_BIN_IVFFLAT,
HNSW,
ANNOY,
FAISS_IVFSQ8NR,
HNSW_SQ8NR,
MAX_VALUE = HNSW_SQ8NR,
};
static std::map<std::string, EngineType> s_map_engine_type = {{"FLAT", EngineType::FAISS_IDMAP},
{"IVFFLAT", EngineType::FAISS_IVFFLAT},
{"IVFSQ8", EngineType::FAISS_IVFSQ8},
{"RNSG", EngineType::NSG_MIX},
{"IVFSQ8H", EngineType::FAISS_IVFSQ8H},
{"IVFPQ", EngineType::FAISS_PQ},
{"SPTAGKDT", EngineType::SPTAG_KDT},
{"SPTAGBKT", EngineType::SPTAG_BKT},
{"HNSW", EngineType::HNSW},
{"ANNOY", EngineType::ANNOY},
{"IVFSQ8NR", EngineType::FAISS_IVFSQ8NR},
{"HNSW_SQ8NR", EngineType::HNSW_SQ8NR}};
enum class MetricType {
L2 = 1, // Euclidean Distance
IP = 2, // Cosine Similarity
HAMMING = 3, // Hamming Distance
JACCARD = 4, // Jaccard Distance
TANIMOTO = 5, // Tanimoto Distance
SUBSTRUCTURE = 6, // Substructure Distance
SUPERSTRUCTURE = 7, // Superstructure Distance
MAX_VALUE = SUPERSTRUCTURE
};
enum class DataType {
INT8 = 1,
INT16 = 2,
INT32 = 3,
INT64 = 4,
STRING = 20,
BOOL = 30,
FLOAT = 40,
DOUBLE = 41,
VECTOR = 100,
UNKNOWN = 9999,
};
class ExecutionEngine { class ExecutionEngine {
public: public:
virtual Status virtual Status
...@@ -144,10 +84,11 @@ class ExecutionEngine { ...@@ -144,10 +84,11 @@ class ExecutionEngine {
virtual Status virtual Status
ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset,
std::unordered_map<std::string, DataType>& attr_type, std::string& vector_placeholder) = 0; std::unordered_map<std::string, meta::hybrid::DataType>& attr_type,
std::string& vector_placeholder) = 0;
virtual Status virtual Status
HybridSearch(scheduler::SearchJobPtr job, std::unordered_map<std::string, DataType>& attr_type, HybridSearch(scheduler::SearchJobPtr job, std::unordered_map<std::string, meta::hybrid::DataType>& attr_type,
std::vector<float>& distances, std::vector<int64_t>& search_ids, bool hybrid) = 0; std::vector<float>& distances, std::vector<int64_t>& search_ids, bool hybrid) = 0;
virtual Status virtual Status
......
...@@ -807,12 +807,12 @@ MapAndCopyResult(const knowhere::DatasetPtr& dataset, const std::vector<milvus:: ...@@ -807,12 +807,12 @@ MapAndCopyResult(const knowhere::DatasetPtr& dataset, const std::vector<milvus::
Status Status
ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query::GeneralQueryPtr general_query, ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query::GeneralQueryPtr general_query,
std::unordered_map<std::string, DataType>& attr_type) { std::unordered_map<std::string, meta::hybrid::DataType>& attr_type) {
auto field_name = general_query->leaf->term_query->field_name; auto field_name = general_query->leaf->term_query->field_name;
auto type = attr_type.at(field_name); auto type = attr_type.at(field_name);
switch (type) { switch (type) {
case DataType::INT8: { case meta::hybrid::DataType::INT8: {
auto int8_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int8_t>>( auto int8_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int8_t>>(
attr_index_->attr_index_data().at(field_name)); attr_index_->attr_index_data().at(field_name));
if (not int8_index) { if (not int8_index) {
...@@ -827,7 +827,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: ...@@ -827,7 +827,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query:
bitset = int8_index->In(term_size, term_value.data()); bitset = int8_index->In(term_size, term_value.data());
break; break;
} }
case DataType::INT16: { case meta::hybrid::DataType::INT16: {
auto int16_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int16_t>>( auto int16_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int16_t>>(
attr_index_->attr_index_data().at(field_name)); attr_index_->attr_index_data().at(field_name));
if (not int16_index) { if (not int16_index) {
...@@ -842,7 +842,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: ...@@ -842,7 +842,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query:
bitset = int16_index->In(term_size, term_value.data()); bitset = int16_index->In(term_size, term_value.data());
break; break;
} }
case DataType::INT32: { case meta::hybrid::DataType::INT32: {
auto int32_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int32_t>>( auto int32_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int32_t>>(
attr_index_->attr_index_data().at(field_name)); attr_index_->attr_index_data().at(field_name));
if (not int32_index) { if (not int32_index) {
...@@ -857,7 +857,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: ...@@ -857,7 +857,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query:
bitset = int32_index->In(term_size, term_value.data()); bitset = int32_index->In(term_size, term_value.data());
break; break;
} }
case DataType::INT64: { case meta::hybrid::DataType::INT64: {
auto int64_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int64_t>>( auto int64_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int64_t>>(
attr_index_->attr_index_data().at(field_name)); attr_index_->attr_index_data().at(field_name));
if (not int64_index) { if (not int64_index) {
...@@ -872,7 +872,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: ...@@ -872,7 +872,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query:
bitset = int64_index->In(term_size, term_value.data()); bitset = int64_index->In(term_size, term_value.data());
break; break;
} }
case DataType::FLOAT: { case meta::hybrid::DataType::FLOAT: {
auto float_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<float>>( auto float_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<float>>(
attr_index_->attr_index_data().at(field_name)); attr_index_->attr_index_data().at(field_name));
if (not float_index) { if (not float_index) {
...@@ -887,7 +887,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: ...@@ -887,7 +887,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query:
bitset = float_index->In(term_size, term_value.data()); bitset = float_index->In(term_size, term_value.data());
break; break;
} }
case DataType::DOUBLE: { case meta::hybrid::DataType::DOUBLE: {
auto double_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<double>>( auto double_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<double>>(
attr_index_->attr_index_data().at(field_name)); attr_index_->attr_index_data().at(field_name));
if (not double_index) { if (not double_index) {
...@@ -909,39 +909,39 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: ...@@ -909,39 +909,39 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query:
} }
Status Status
ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const std::string& operand, ExecutionEngineImpl::ProcessRangeQuery(const meta::hybrid::DataType data_type, const std::string& operand,
const query::CompareOperator& com_operator, knowhere::IndexPtr& index_ptr, const query::CompareOperator& com_operator, knowhere::IndexPtr& index_ptr,
faiss::ConcurrentBitsetPtr& bitset) { faiss::ConcurrentBitsetPtr& bitset) {
switch (data_type) { switch (data_type) {
case DataType::INT8: { case meta::hybrid::DataType::INT8: {
auto int8_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int8_t>>(index_ptr); auto int8_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int8_t>>(index_ptr);
int8_t value = atoi(operand.c_str()); int8_t value = atoi(operand.c_str());
bitset = int8_index->Range(value, (knowhere::OperatorType)com_operator); bitset = int8_index->Range(value, (knowhere::OperatorType)com_operator);
break; break;
} }
case DataType::INT16: { case meta::hybrid::DataType::INT16: {
auto int16_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int16_t>>(index_ptr); auto int16_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int16_t>>(index_ptr);
int16_t value = atoi(operand.c_str()); int16_t value = atoi(operand.c_str());
bitset = int16_index->Range(value, (knowhere::OperatorType)com_operator); bitset = int16_index->Range(value, (knowhere::OperatorType)com_operator);
break; break;
} }
case DataType::INT32: { case meta::hybrid::DataType::INT32: {
auto int32_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int32_t>>(index_ptr); auto int32_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int32_t>>(index_ptr);
int32_t value = atoi(operand.c_str()); int32_t value = atoi(operand.c_str());
bitset = int32_index->Range(value, (knowhere::OperatorType)com_operator); bitset = int32_index->Range(value, (knowhere::OperatorType)com_operator);
break; break;
} }
case DataType::INT64: { case meta::hybrid::DataType::INT64: {
auto int64_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int64_t>>(index_ptr); auto int64_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<int64_t>>(index_ptr);
int64_t value = atoi(operand.c_str()); int64_t value = atoi(operand.c_str());
bitset = int64_index->Range(value, (knowhere::OperatorType)com_operator); bitset = int64_index->Range(value, (knowhere::OperatorType)com_operator);
break; break;
} }
case DataType::FLOAT: { case meta::hybrid::DataType::FLOAT: {
auto float_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<float>>(index_ptr); auto float_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<float>>(index_ptr);
std::istringstream iss(operand); std::istringstream iss(operand);
...@@ -950,7 +950,7 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s ...@@ -950,7 +950,7 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s
bitset = float_index->Range(value, (knowhere::OperatorType)com_operator); bitset = float_index->Range(value, (knowhere::OperatorType)com_operator);
break; break;
} }
case DataType::DOUBLE: { case meta::hybrid::DataType::DOUBLE: {
auto double_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<double>>(index_ptr); auto double_index = std::dynamic_pointer_cast<knowhere::StructuredIndexSort<double>>(index_ptr);
std::istringstream iss(operand); std::istringstream iss(operand);
...@@ -967,8 +967,8 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s ...@@ -967,8 +967,8 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s
Status Status
ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job,
std::unordered_map<std::string, DataType>& attr_type, std::vector<float>& distances, std::unordered_map<std::string, meta::hybrid::DataType>& attr_type,
std::vector<int64_t>& search_ids, bool hybrid) { std::vector<float>& distances, std::vector<int64_t>& search_ids, bool hybrid) {
faiss::ConcurrentBitsetPtr bitset; faiss::ConcurrentBitsetPtr bitset;
std::string vector_placeholder; std::string vector_placeholder;
auto status = ExecBinaryQuery(search_job->general_query(), bitset, attr_type, vector_placeholder); auto status = ExecBinaryQuery(search_job->general_query(), bitset, attr_type, vector_placeholder);
...@@ -991,7 +991,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, ...@@ -991,7 +991,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job,
int64_t topk = vector_query->topk; int64_t topk = vector_query->topk;
int64_t nq = vector_query->query_vector.float_data.size() / dim_; int64_t nq = vector_query->query_vector.float_data.size() / dim_;
engine::VectorsData vectors; VectorsData vectors;
vectors.vector_count_ = nq; vectors.vector_count_ = nq;
vectors.float_data_ = vector_query->query_vector.float_data; vectors.float_data_ = vector_query->query_vector.float_data;
vectors.binary_data_ = vector_query->query_vector.binary_data; vectors.binary_data_ = vector_query->query_vector.binary_data;
...@@ -1009,7 +1009,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, ...@@ -1009,7 +1009,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job,
} }
Status Status
ExecutionEngineImpl::ExecBinaryQuery(milvus::query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, ExecutionEngineImpl::ExecBinaryQuery(milvus::query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset,
std::unordered_map<std::string, DataType>& attr_type, std::unordered_map<std::string, meta::hybrid::DataType>& attr_type,
std::string& vector_placeholder) { std::string& vector_placeholder) {
Status status = Status::OK(); Status status = Status::OK();
if (general_query->leaf == nullptr) { if (general_query->leaf == nullptr) {
...@@ -1273,7 +1273,7 @@ ExecutionEngineImpl::Search(std::vector<int64_t>& ids, std::vector<float>& dista ...@@ -1273,7 +1273,7 @@ ExecutionEngineImpl::Search(std::vector<int64_t>& ids, std::vector<float>& dista
uint64_t nq = job->nq(); uint64_t nq = job->nq();
uint64_t topk = job->topk(); uint64_t topk = job->topk();
const engine::VectorsData& vectors = job->vectors(); const VectorsData& vectors = job->vectors();
ids.resize(topk * nq); ids.resize(topk * nq);
distances.resize(topk * nq); distances.resize(topk * nq);
......
...@@ -78,10 +78,11 @@ class ExecutionEngineImpl : public ExecutionEngine { ...@@ -78,10 +78,11 @@ class ExecutionEngineImpl : public ExecutionEngine {
Status Status
ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset,
std::unordered_map<std::string, DataType>& attr_type, std::string& vector_placeholder) override; std::unordered_map<std::string, meta::hybrid::DataType>& attr_type,
std::string& vector_placeholder) override;
Status Status
HybridSearch(scheduler::SearchJobPtr job, std::unordered_map<std::string, DataType>& attr_type, HybridSearch(scheduler::SearchJobPtr job, std::unordered_map<std::string, meta::hybrid::DataType>& attr_type,
std::vector<float>& distances, std::vector<int64_t>& search_ids, bool hybrid) override; std::vector<float>& distances, std::vector<int64_t>& search_ids, bool hybrid) override;
Status Status
...@@ -128,10 +129,10 @@ class ExecutionEngineImpl : public ExecutionEngine { ...@@ -128,10 +129,10 @@ class ExecutionEngineImpl : public ExecutionEngine {
Status Status
ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query::GeneralQueryPtr general_query, ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query::GeneralQueryPtr general_query,
std::unordered_map<std::string, DataType>& attr_type); std::unordered_map<std::string, meta::hybrid::DataType>& attr_type);
Status Status
ProcessRangeQuery(const engine::DataType data_type, const std::string& operand, ProcessRangeQuery(const meta::hybrid::DataType data_type, const std::string& operand,
const query::CompareOperator& com_operator, knowhere::IndexPtr& index_ptr, const query::CompareOperator& com_operator, knowhere::IndexPtr& index_ptr,
faiss::ConcurrentBitsetPtr& bitset); faiss::ConcurrentBitsetPtr& bitset);
......
...@@ -17,11 +17,55 @@ ...@@ -17,11 +17,55 @@
#include <vector> #include <vector>
#include "db/Constants.h" #include "db/Constants.h"
#include "db/engine/ExecutionEngine.h"
#include "src/version.h" #include "src/version.h"
namespace milvus { namespace milvus {
namespace engine { namespace engine {
// TODO(linxj): replace with VecIndex::IndexType
enum class EngineType {
INVALID = 0,
FAISS_IDMAP = 1,
FAISS_IVFFLAT,
FAISS_IVFSQ8,
NSG_MIX,
FAISS_IVFSQ8H,
FAISS_PQ,
SPTAG_KDT,
SPTAG_BKT,
FAISS_BIN_IDMAP,
FAISS_BIN_IVFFLAT,
HNSW,
ANNOY,
FAISS_IVFSQ8NR,
HNSW_SQ8NR,
MAX_VALUE = HNSW_SQ8NR,
};
static std::map<std::string, EngineType> s_map_engine_type = {{"FLAT", EngineType::FAISS_IDMAP},
{"IVFFLAT", EngineType::FAISS_IVFFLAT},
{"IVFSQ8", EngineType::FAISS_IVFSQ8},
{"RNSG", EngineType::NSG_MIX},
{"IVFSQ8H", EngineType::FAISS_IVFSQ8H},
{"IVFPQ", EngineType::FAISS_PQ},
{"SPTAGKDT", EngineType::SPTAG_KDT},
{"SPTAGBKT", EngineType::SPTAG_BKT},
{"HNSW", EngineType::HNSW},
{"ANNOY", EngineType::ANNOY},
{"IVFSQ8NR", EngineType::FAISS_IVFSQ8NR},
{"HNSW_SQ8NR", EngineType::HNSW_SQ8NR}};
enum class MetricType {
L2 = 1, // Euclidean Distance
IP = 2, // Cosine Similarity
HAMMING = 3, // Hamming Distance
JACCARD = 4, // Jaccard Distance
TANIMOTO = 5, // Tanimoto Distance
SUBSTRUCTURE = 6, // Substructure Distance
SUPERSTRUCTURE = 7, // Superstructure Distance
MAX_VALUE = SUPERSTRUCTURE
};
namespace meta { namespace meta {
constexpr int32_t DEFAULT_ENGINE_TYPE = (int)EngineType::FAISS_IDMAP; constexpr int32_t DEFAULT_ENGINE_TYPE = (int)EngineType::FAISS_IDMAP;
......
...@@ -61,7 +61,7 @@ set(vector_index_srcs ...@@ -61,7 +61,7 @@ set(vector_index_srcs
knowhere/index/vector_index/IndexIVFPQ.cpp knowhere/index/vector_index/IndexIVFPQ.cpp
knowhere/index/vector_index/IndexIVFSQ.cpp knowhere/index/vector_index/IndexIVFSQ.cpp
knowhere/index/vector_index/IndexIVFSQNR.cpp knowhere/index/vector_index/IndexIVFSQNR.cpp
knowhere/index/vector_index/IndexType.cpp knowhere/index/IndexType.cpp
knowhere/index/vector_index/VecIndexFactory.cpp knowhere/index/vector_index/VecIndexFactory.cpp
knowhere/index/vector_index/IndexAnnoy.cpp knowhere/index/vector_index/IndexAnnoy.cpp
) )
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License // or implied. See the License for the specific language governing permissions and limitations under the License
#include "knowhere/index/vector_index/IndexType.h"
#include <unordered_map> #include <unordered_map>
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <vector> #include <vector>
#include "knowhere/common/Config.h" #include "knowhere/common/Config.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/ConfAdapter.h" #include "knowhere/index/vector_index/ConfAdapter.h"
#include "knowhere/index/vector_index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "knowhere/common/BinarySet.h" #include "knowhere/common/BinarySet.h"
#include "knowhere/common/Dataset.h" #include "knowhere/common/Dataset.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include <fiu-local.h> #include <fiu-local.h>
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/FaissBaseIndex.h" #include "knowhere/index/vector_index/FaissBaseIndex.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/helpers/FaissIO.h" #include "knowhere/index/vector_index/helpers/FaissIO.h"
namespace milvus { namespace milvus {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <faiss/Index.h> #include <faiss/Index.h>
#include "knowhere/common/BinarySet.h" #include "knowhere/common/BinarySet.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIDMAP.h"
#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVF.h"
#include "knowhere/index/vector_index/IndexNSG.h" #include "knowhere/index/vector_index/IndexNSG.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h"
#include "knowhere/index/vector_index/impl/nsg/NSG.h" #include "knowhere/index/vector_index/impl/nsg/NSG.h"
#include "knowhere/index/vector_index/impl/nsg/NSGIO.h" #include "knowhere/index/vector_index/impl/nsg/NSGIO.h"
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Typedef.h" #include "knowhere/common/Typedef.h"
#include "knowhere/index/Index.h" #include "knowhere/index/Index.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <memory> #include <memory>
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/VecIndex.h" #include "knowhere/index/vector_index/VecIndex.h"
namespace milvus { namespace milvus {
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include <fiu-local.h> #include <fiu-local.h>
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIDMAP.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h"
#include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h" #include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h"
#include "knowhere/index/vector_index/helpers/FaissIO.h" #include "knowhere/index/vector_index/helpers/FaissIO.h"
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIDMAP.h"
#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVF.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h"
#include "knowhere/index/vector_index/impl/nsg/NSGIO.h" #include "knowhere/index/vector_index/impl/nsg/NSGIO.h"
#include "knowhere/index/vector_offset_index/IndexNSG_NM.h" #include "knowhere/index/vector_offset_index/IndexNSG_NM.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <fiu-local.h> #include <fiu-local.h>
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/helpers/FaissIO.h" #include "knowhere/index/vector_index/helpers/FaissIO.h"
#include "knowhere/index/vector_offset_index/OffsetBaseIndex.h" #include "knowhere/index/vector_offset_index/OffsetBaseIndex.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <faiss/Index.h> #include <faiss/Index.h>
#include "knowhere/common/BinarySet.h" #include "knowhere/common/BinarySet.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
namespace milvus { namespace milvus {
namespace knowhere { namespace knowhere {
......
...@@ -31,7 +31,7 @@ set(util_srcs ...@@ -31,7 +31,7 @@ set(util_srcs
${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/adapter/VectorAdapter.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/adapter/VectorAdapter.cpp
${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/helpers/FaissIO.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/helpers/FaissIO.cpp
${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/helpers/IndexParameter.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/helpers/IndexParameter.cpp
${INDEX_SOURCE_DIR}/knowhere/knowhere/index/vector_index/IndexType.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/index/IndexType.cpp
${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Exception.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Exception.cpp
${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Log.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Log.cpp
${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Timer.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Timer.cpp
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVF.h"
#include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFPQ.h"
#include "knowhere/index/vector_index/IndexIVFSQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h"
#include "knowhere/index/vector_index/IndexIVFSQNR.h" #include "knowhere/index/vector_index/IndexIVFSQNR.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/helpers/IndexParameter.h" #include "knowhere/index/vector_index/helpers/IndexParameter.h"
#include "knowhere/index/vector_offset_index/IndexIVF_NM.h" #include "knowhere/index/vector_offset_index/IndexIVF_NM.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <thread> #include <thread>
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
#include "unittest/Helper.h" #include "unittest/Helper.h"
#include "unittest/utils.h" #include "unittest/utils.h"
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVF.h"
#include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFPQ.h"
#include "knowhere/index/vector_index/IndexIVFSQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/gpu/IndexGPUIVF.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVF.h"
#include "knowhere/index/vector_index/gpu/IndexGPUIVFPQ.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVFPQ.h"
#include "knowhere/index/vector_index/gpu/IndexGPUIVFSQ.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVFSQ.h"
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include <thread> #include <thread>
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIDMAP.h"
#include "knowhere/index/vector_index/IndexType.h"
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
#include <faiss/gpu/GpuCloner.h> #include <faiss/gpu/GpuCloner.h>
#include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h" #include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h"
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVF.h"
#include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFPQ.h"
#include "knowhere/index/vector_index/IndexIVFSQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h"
#include "knowhere/index/vector_index/IndexIVFSQNR.h" #include "knowhere/index/vector_index/IndexIVFSQNR.h"
#include "knowhere/index/vector_index/IndexType.h"
#include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h"
#ifdef MILVUS_GPU_VERSION #ifdef MILVUS_GPU_VERSION
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h"
#include "knowhere/index/vector_offset_index/IndexIVF_NM.h" #include "knowhere/index/vector_offset_index/IndexIVF_NM.h"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "knowhere/common/Exception.h" #include "knowhere/common/Exception.h"
#include "knowhere/common/Timer.h" #include "knowhere/common/Timer.h"
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/adapter/VectorAdapter.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h"
#include "knowhere/index/vector_offset_index/IndexIVF_NM.h" #include "knowhere/index/vector_offset_index/IndexIVF_NM.h"
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/IndexType.h"
#include "knowhere/index/vector_index/VecIndex.h" #include "knowhere/index/vector_index/VecIndex.h"
#include "knowhere/index/vector_index/VecIndexFactory.h" #include "knowhere/index/vector_index/VecIndexFactory.h"
#include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h" #include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h"
......
...@@ -35,6 +35,7 @@ using ExecutionEnginePtr = engine::ExecutionEnginePtr; ...@@ -35,6 +35,7 @@ using ExecutionEnginePtr = engine::ExecutionEnginePtr;
using EngineFactory = engine::EngineFactory; using EngineFactory = engine::EngineFactory;
using EngineType = engine::EngineType; using EngineType = engine::EngineType;
using MetricType = engine::MetricType; using MetricType = engine::MetricType;
using DataType = engine::meta::hybrid::DataType;
constexpr uint64_t TASK_TABLE_MAX_COUNT = 1ULL << 16ULL; constexpr uint64_t TASK_TABLE_MAX_COUNT = 1ULL << 16ULL;
......
...@@ -127,11 +127,11 @@ XSearchTask::XSearchTask(const std::shared_ptr<server::Context>& context, Segmen ...@@ -127,11 +127,11 @@ XSearchTask::XSearchTask(const std::shared_ptr<server::Context>& context, Segmen
// auto search_job = std::static_pointer_cast<scheduler::SearchJob>(job); // auto search_job = std::static_pointer_cast<scheduler::SearchJob>(job);
// query::GeneralQueryPtr general_query = search_job->general_query(); // query::GeneralQueryPtr general_query = search_job->general_query();
// if (general_query != nullptr) { // if (general_query != nullptr) {
// std::unordered_map<std::string, engine::DataType> types; // std::unordered_map<std::string, DataType> types;
// auto attr_type = search_job->attr_type(); // auto attr_type = search_job->attr_type();
// auto type_it = attr_type.begin(); // auto type_it = attr_type.begin();
// for (; type_it != attr_type.end(); type_it++) { // for (; type_it != attr_type.end(); type_it++) {
// types.insert(std::make_pair(type_it->first, (engine::DataType)(type_it->second))); // types.insert(std::make_pair(type_it->first, (DataType)(type_it->second)));
// } // }
// index_engine_ = // index_engine_ =
// EngineFactory::Build(file_->dimension_, file_->location_, engine_type, // EngineFactory::Build(file_->dimension_, file_->location_, engine_type,
...@@ -250,11 +250,11 @@ XSearchTask::Execute() { ...@@ -250,11 +250,11 @@ XSearchTask::Execute() {
} }
Status s; Status s;
if (general_query != nullptr) { if (general_query != nullptr) {
std::unordered_map<std::string, engine::DataType> types; std::unordered_map<std::string, DataType> types;
auto attr_type = search_job->attr_type(); auto attr_type = search_job->attr_type();
auto type_it = attr_type.begin(); auto type_it = attr_type.begin();
for (; type_it != attr_type.end(); type_it++) { for (; type_it != attr_type.end(); type_it++) {
types.insert(std::make_pair(type_it->first, (engine::DataType)(type_it->second))); types.insert(std::make_pair(type_it->first, (DataType)(type_it->second)));
} }
auto query_ptr = search_job->query_ptr(); auto query_ptr = search_job->query_ptr();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册