diff --git a/CHANGELOG.md b/CHANGELOG.md index 3011f54cb820599f529306dda07a7326b5025981..3bb852a43c8ecfb0a187b0451392b6f89e2698a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Please mark all changes in change log and use the issue from GitHub - \#2561 Clean util dependencies with other modules - \#2612 Move all APIs in utils into namespace milvus - \#2675 Print out system memory size when report invalid cpu cache size +- \#2841 Replace IndexType/EngineType/MetricType ## Task diff --git a/core/src/db/engine/ExecutionEngine.h b/core/src/db/engine/ExecutionEngine.h index a59d05e5b5441c96bbb84b9c8b1794190a93932b..1f91a951d0d126c684e308d5c6922f8219981169 100644 --- a/core/src/db/engine/ExecutionEngine.h +++ b/core/src/db/engine/ExecutionEngine.h @@ -19,6 +19,7 @@ #include +#include "db/meta/MetaTypes.h" #include "query/GeneralQuery.h" #include "utils/Json.h" #include "utils/Status.h" @@ -32,67 +33,6 @@ using SearchJobPtr = std::shared_ptr; 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 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 { public: virtual Status @@ -144,10 +84,11 @@ class ExecutionEngine { virtual Status ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, - std::unordered_map& attr_type, std::string& vector_placeholder) = 0; + std::unordered_map& attr_type, + std::string& vector_placeholder) = 0; virtual Status - HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, + HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, std::vector& distances, std::vector& search_ids, bool hybrid) = 0; virtual Status diff --git a/core/src/db/engine/ExecutionEngineImpl.cpp b/core/src/db/engine/ExecutionEngineImpl.cpp index a1e69a3ee233f4b60175f0b8b8245fb8f8d0735c..6871c4832f72d602bb4988243953cef9d4d03765 100644 --- a/core/src/db/engine/ExecutionEngineImpl.cpp +++ b/core/src/db/engine/ExecutionEngineImpl.cpp @@ -807,12 +807,12 @@ MapAndCopyResult(const knowhere::DatasetPtr& dataset, const std::vector& attr_type) { + std::unordered_map& attr_type) { auto field_name = general_query->leaf->term_query->field_name; auto type = attr_type.at(field_name); switch (type) { - case DataType::INT8: { + case meta::hybrid::DataType::INT8: { auto int8_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int8_index) { @@ -827,7 +827,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int8_index->In(term_size, term_value.data()); break; } - case DataType::INT16: { + case meta::hybrid::DataType::INT16: { auto int16_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int16_index) { @@ -842,7 +842,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int16_index->In(term_size, term_value.data()); break; } - case DataType::INT32: { + case meta::hybrid::DataType::INT32: { auto int32_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int32_index) { @@ -857,7 +857,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int32_index->In(term_size, term_value.data()); break; } - case DataType::INT64: { + case meta::hybrid::DataType::INT64: { auto int64_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not int64_index) { @@ -872,7 +872,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = int64_index->In(term_size, term_value.data()); break; } - case DataType::FLOAT: { + case meta::hybrid::DataType::FLOAT: { auto float_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not float_index) { @@ -887,7 +887,7 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: bitset = float_index->In(term_size, term_value.data()); break; } - case DataType::DOUBLE: { + case meta::hybrid::DataType::DOUBLE: { auto double_index = std::dynamic_pointer_cast>( attr_index_->attr_index_data().at(field_name)); if (not double_index) { @@ -909,39 +909,39 @@ ExecutionEngineImpl::ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query: } 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, faiss::ConcurrentBitsetPtr& bitset) { switch (data_type) { - case DataType::INT8: { + case meta::hybrid::DataType::INT8: { auto int8_index = std::dynamic_pointer_cast>(index_ptr); int8_t value = atoi(operand.c_str()); bitset = int8_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::INT16: { + case meta::hybrid::DataType::INT16: { auto int16_index = std::dynamic_pointer_cast>(index_ptr); int16_t value = atoi(operand.c_str()); bitset = int16_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::INT32: { + case meta::hybrid::DataType::INT32: { auto int32_index = std::dynamic_pointer_cast>(index_ptr); int32_t value = atoi(operand.c_str()); bitset = int32_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::INT64: { + case meta::hybrid::DataType::INT64: { auto int64_index = std::dynamic_pointer_cast>(index_ptr); int64_t value = atoi(operand.c_str()); bitset = int64_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::FLOAT: { + case meta::hybrid::DataType::FLOAT: { auto float_index = std::dynamic_pointer_cast>(index_ptr); std::istringstream iss(operand); @@ -950,7 +950,7 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s bitset = float_index->Range(value, (knowhere::OperatorType)com_operator); break; } - case DataType::DOUBLE: { + case meta::hybrid::DataType::DOUBLE: { auto double_index = std::dynamic_pointer_cast>(index_ptr); std::istringstream iss(operand); @@ -967,8 +967,8 @@ ExecutionEngineImpl::ProcessRangeQuery(const engine::DataType data_type, const s Status ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, - std::unordered_map& attr_type, std::vector& distances, - std::vector& search_ids, bool hybrid) { + std::unordered_map& attr_type, + std::vector& distances, std::vector& search_ids, bool hybrid) { faiss::ConcurrentBitsetPtr bitset; std::string vector_placeholder; auto status = ExecBinaryQuery(search_job->general_query(), bitset, attr_type, vector_placeholder); @@ -991,7 +991,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, int64_t topk = vector_query->topk; int64_t nq = vector_query->query_vector.float_data.size() / dim_; - engine::VectorsData vectors; + VectorsData vectors; vectors.vector_count_ = nq; vectors.float_data_ = vector_query->query_vector.float_data; vectors.binary_data_ = vector_query->query_vector.binary_data; @@ -1009,7 +1009,7 @@ ExecutionEngineImpl::HybridSearch(scheduler::SearchJobPtr search_job, } Status ExecutionEngineImpl::ExecBinaryQuery(milvus::query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, - std::unordered_map& attr_type, + std::unordered_map& attr_type, std::string& vector_placeholder) { Status status = Status::OK(); if (general_query->leaf == nullptr) { @@ -1273,7 +1273,7 @@ ExecutionEngineImpl::Search(std::vector& ids, std::vector& dista uint64_t nq = job->nq(); uint64_t topk = job->topk(); - const engine::VectorsData& vectors = job->vectors(); + const VectorsData& vectors = job->vectors(); ids.resize(topk * nq); distances.resize(topk * nq); diff --git a/core/src/db/engine/ExecutionEngineImpl.h b/core/src/db/engine/ExecutionEngineImpl.h index c4a5c6bd978ecad4c63dc0661ba29c3531729e6e..cbef0808c6b453bff64e81d24e35b6704bb5cb6f 100644 --- a/core/src/db/engine/ExecutionEngineImpl.h +++ b/core/src/db/engine/ExecutionEngineImpl.h @@ -78,10 +78,11 @@ class ExecutionEngineImpl : public ExecutionEngine { Status ExecBinaryQuery(query::GeneralQueryPtr general_query, faiss::ConcurrentBitsetPtr& bitset, - std::unordered_map& attr_type, std::string& vector_placeholder) override; + std::unordered_map& attr_type, + std::string& vector_placeholder) override; Status - HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, + HybridSearch(scheduler::SearchJobPtr job, std::unordered_map& attr_type, std::vector& distances, std::vector& search_ids, bool hybrid) override; Status @@ -128,10 +129,10 @@ class ExecutionEngineImpl : public ExecutionEngine { Status ProcessTermQuery(faiss::ConcurrentBitsetPtr& bitset, query::GeneralQueryPtr general_query, - std::unordered_map& attr_type); + std::unordered_map& attr_type); 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, faiss::ConcurrentBitsetPtr& bitset); diff --git a/core/src/db/meta/MetaTypes.h b/core/src/db/meta/MetaTypes.h index 029347fe7e7998d6968fb5daec09742049de04f1..c7685b01e5ba301df99fa98b4a4e49fddefa6028 100644 --- a/core/src/db/meta/MetaTypes.h +++ b/core/src/db/meta/MetaTypes.h @@ -17,11 +17,55 @@ #include #include "db/Constants.h" -#include "db/engine/ExecutionEngine.h" #include "src/version.h" namespace milvus { 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 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 { constexpr int32_t DEFAULT_ENGINE_TYPE = (int)EngineType::FAISS_IDMAP; diff --git a/core/src/index/knowhere/CMakeLists.txt b/core/src/index/knowhere/CMakeLists.txt index 28a7cfdfcc788917a10195a670b3d1806997f504..9cffa80068a5ca8ac1e2c23539e4deeaf364c685 100644 --- a/core/src/index/knowhere/CMakeLists.txt +++ b/core/src/index/knowhere/CMakeLists.txt @@ -61,7 +61,7 @@ set(vector_index_srcs knowhere/index/vector_index/IndexIVFPQ.cpp knowhere/index/vector_index/IndexIVFSQ.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/IndexAnnoy.cpp ) diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexType.cpp b/core/src/index/knowhere/knowhere/index/IndexType.cpp similarity index 98% rename from core/src/index/knowhere/knowhere/index/vector_index/IndexType.cpp rename to core/src/index/knowhere/knowhere/index/IndexType.cpp index 02fbbb4034cc28ad5f3e70d8ac5a946c8c23d607..b8c5ffef8feba32d9eb59ab70e5bf9e0b136ae3f 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexType.cpp +++ b/core/src/index/knowhere/knowhere/index/IndexType.cpp @@ -9,9 +9,10 @@ // 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 -#include "knowhere/index/vector_index/IndexType.h" #include + #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexType.h b/core/src/index/knowhere/knowhere/index/IndexType.h similarity index 100% rename from core/src/index/knowhere/knowhere/index/vector_index/IndexType.h rename to core/src/index/knowhere/knowhere/index/IndexType.h diff --git a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h index 11ecd560b1e2d57ca322aad8f94321e4420b835a..7ac1454292f830d24a6c4c99695a88b25b194b04 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapter.h @@ -16,7 +16,7 @@ #include #include "knowhere/common/Config.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h index 5d8c24f3226a1ec1ae45fbbe93861f243d07f1a1..83b9d0f5845ec9d499cc79b59692cdec3f879139 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/ConfAdapterMgr.h @@ -15,8 +15,8 @@ #include #include +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/ConfAdapter.h" -#include "knowhere/index/vector_index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h index f4d8784749fa282838a97d36d5dd1e5ac25218e9..5db3fb4982bb92c29a93282235fe23d098c76dda 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseBinaryIndex.h @@ -18,7 +18,7 @@ #include "knowhere/common/BinarySet.h" #include "knowhere/common/Dataset.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp index f0a6facefcf4d1b6166277176964d73e99137ec6..99693366481997929ac5af617f0a88578d8b6013 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.cpp @@ -13,8 +13,8 @@ #include #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/FaissBaseIndex.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/helpers/FaissIO.h" namespace milvus { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h index 0da01238777299f5957727986d629d273b40b62c..53a9c3a307cf54c0209093f5028950270308b5e0 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/FaissBaseIndex.h @@ -17,7 +17,7 @@ #include #include "knowhere/common/BinarySet.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp b/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp index fe9933e7addf7265ae15503576198252f9a2a3f8..782e08c3a547676443e5a1590f78e5f0361e66f9 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/IndexNSG.cpp @@ -14,10 +14,10 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.h" #include "knowhere/index/vector_index/IndexIVF.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/impl/nsg/NSG.h" #include "knowhere/index/vector_index/impl/nsg/NSGIO.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h b/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h index 2bb3e181688486b10003e49370227b660b940401..35283cda31997d657d49b34b8067571e6573d2a8 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/VecIndex.h @@ -20,7 +20,7 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Typedef.h" #include "knowhere/index/Index.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h b/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h index 7a09b54bff7057e9ead1f2177dfc6d0f7184b960..c96bd1dc7cf36e7407a0abdade4430e7a3b8af3d 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h +++ b/core/src/index/knowhere/knowhere/index/vector_index/VecIndexFactory.h @@ -13,7 +13,7 @@ #include -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/VecIndex.h" namespace milvus { diff --git a/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp b/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp index 5bcc288c32c095f202709a44f957cbe074015642..2585f88ba17737081de101640be61958a49cb7e7 100644 --- a/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp @@ -19,8 +19,8 @@ #include #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.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/gpu/IndexGPUIDMAP.h" #include "knowhere/index/vector_index/helpers/FaissIO.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp b/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp index ad446fbe1e2eaa41d4b79d50b0504ef6d6fa7638..496048d2b16da427b4716d7ce23a8edd5684dfa6 100644 --- a/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_offset_index/IndexNSG_NM.cpp @@ -14,9 +14,9 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.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/impl/nsg/NSGIO.h" #include "knowhere/index/vector_offset_index/IndexNSG_NM.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp index 6becbba0adae79eba55f56da02016e0b91015b22..186eac4e4345d5fc5ea3f3873c1fb988598b25fc 100644 --- a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp +++ b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.cpp @@ -13,7 +13,7 @@ #include #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_offset_index/OffsetBaseIndex.h" diff --git a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h index 19908ce34504630f51321740aba22d5669ca4380..029d8f9f69474a4a508190025194b05a6d9a375a 100644 --- a/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h +++ b/core/src/index/knowhere/knowhere/index/vector_offset_index/OffsetBaseIndex.h @@ -17,7 +17,7 @@ #include #include "knowhere/common/BinarySet.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" namespace milvus { namespace knowhere { diff --git a/core/src/index/unittest/CMakeLists.txt b/core/src/index/unittest/CMakeLists.txt index 419b5516b9fb62cd3c516c81d209fd1f4392e7c9..e5e1cad6c1c5c29b1988bf768fa027b1eba21e9e 100644 --- a/core/src/index/unittest/CMakeLists.txt +++ b/core/src/index/unittest/CMakeLists.txt @@ -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/helpers/FaissIO.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/Log.cpp ${INDEX_SOURCE_DIR}/knowhere/knowhere/common/Timer.cpp diff --git a/core/src/index/unittest/Helper.h b/core/src/index/unittest/Helper.h index f352b90ed1d44e9277a986ef88dd0be50bcf1216..8a9c831199639b67cbdc56a0a68f7c98b41cc6a1 100644 --- a/core/src/index/unittest/Helper.h +++ b/core/src/index/unittest/Helper.h @@ -12,11 +12,11 @@ #include #include +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.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_offset_index/IndexIVF_NM.h" diff --git a/core/src/index/unittest/test_customized_index.cpp b/core/src/index/unittest/test_customized_index.cpp index 03c55d4509cea9ba4c3ad597481e7918ff3e346f..0c877f06440270c56225621e3a0f6c38158102e3 100644 --- a/core/src/index/unittest/test_customized_index.cpp +++ b/core/src/index/unittest/test_customized_index.cpp @@ -15,7 +15,7 @@ #include #include "knowhere/common/Timer.h" -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "unittest/Helper.h" #include "unittest/utils.h" diff --git a/core/src/index/unittest/test_gpuresource.cpp b/core/src/index/unittest/test_gpuresource.cpp index e70404e176546d98d960e5bdcae43906a8012393..2c7a30a5653e5e24af256076226046e8fbed8c00 100644 --- a/core/src/index/unittest/test_gpuresource.cpp +++ b/core/src/index/unittest/test_gpuresource.cpp @@ -20,10 +20,10 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVFPQ.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/IndexGPUIVFPQ.h" #include "knowhere/index/vector_index/gpu/IndexGPUIVFSQ.h" diff --git a/core/src/index/unittest/test_idmap.cpp b/core/src/index/unittest/test_idmap.cpp index 2abbd8e27036c8769168109cc536f74278887bdd..39a73553af59d780052e390e22e04571a31f933f 100644 --- a/core/src/index/unittest/test_idmap.cpp +++ b/core/src/index/unittest/test_idmap.cpp @@ -17,8 +17,8 @@ #include #include "knowhere/common/Exception.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIDMAP.h" -#include "knowhere/index/vector_index/IndexType.h" #ifdef MILVUS_GPU_VERSION #include #include "knowhere/index/vector_index/gpu/IndexGPUIDMAP.h" diff --git a/core/src/index/unittest/test_ivf.cpp b/core/src/index/unittest/test_ivf.cpp index 0e22836d19f2fedbad0da53054a4ddd46d044ec9..20d5d8c66e7c90c8e822df692aa4ae7911ef6020 100644 --- a/core/src/index/unittest/test_ivf.cpp +++ b/core/src/index/unittest/test_ivf.cpp @@ -22,11 +22,11 @@ #include "knowhere/common/Exception.h" #include "knowhere/common/Timer.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/IndexIVF.h" #include "knowhere/index/vector_index/IndexIVFPQ.h" #include "knowhere/index/vector_index/IndexIVFSQ.h" #include "knowhere/index/vector_index/IndexIVFSQNR.h" -#include "knowhere/index/vector_index/IndexType.h" #include "knowhere/index/vector_index/adapter/VectorAdapter.h" #ifdef MILVUS_GPU_VERSION diff --git a/core/src/index/unittest/test_ivf_cpu_nm.cpp b/core/src/index/unittest/test_ivf_cpu_nm.cpp index 61cf7d1a727ef9f386b04209e09941e568a72c8a..56a5869a64b0a458809f27a5ae6153fcefa7e836 100644 --- a/core/src/index/unittest/test_ivf_cpu_nm.cpp +++ b/core/src/index/unittest/test_ivf_cpu_nm.cpp @@ -22,7 +22,7 @@ #include "knowhere/common/Exception.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_offset_index/IndexIVF_NM.h" diff --git a/core/src/index/unittest/test_ivf_gpu_nm.cpp b/core/src/index/unittest/test_ivf_gpu_nm.cpp index ec7087a264da9e0737705a5d0c3235051956d314..7c9c6e145c95ef9350c1decb35c41253688851b9 100644 --- a/core/src/index/unittest/test_ivf_gpu_nm.cpp +++ b/core/src/index/unittest/test_ivf_gpu_nm.cpp @@ -22,7 +22,7 @@ #include "knowhere/common/Exception.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_offset_index/IndexIVF_NM.h" diff --git a/core/src/index/unittest/test_vecindex.cpp b/core/src/index/unittest/test_vecindex.cpp index dc231f640362e30436b4a95203a55dd9742ac9d0..713e9d7988a40ca58190cd3cfe6d8358a3f84876 100644 --- a/core/src/index/unittest/test_vecindex.cpp +++ b/core/src/index/unittest/test_vecindex.cpp @@ -11,7 +11,7 @@ #include -#include "knowhere/index/vector_index/IndexType.h" +#include "knowhere/index/IndexType.h" #include "knowhere/index/vector_index/VecIndex.h" #include "knowhere/index/vector_index/VecIndexFactory.h" #include "knowhere/index/vector_index/helpers/FaissGpuResourceMgr.h" diff --git a/core/src/scheduler/Definition.h b/core/src/scheduler/Definition.h index 10526804c9189e00bb57ed7e01e9610fe8a5c7f0..ed5fcb89e5a6fb1541f35ed5d696eced84fc6f40 100644 --- a/core/src/scheduler/Definition.h +++ b/core/src/scheduler/Definition.h @@ -35,6 +35,7 @@ using ExecutionEnginePtr = engine::ExecutionEnginePtr; using EngineFactory = engine::EngineFactory; using EngineType = engine::EngineType; using MetricType = engine::MetricType; +using DataType = engine::meta::hybrid::DataType; constexpr uint64_t TASK_TABLE_MAX_COUNT = 1ULL << 16ULL; diff --git a/core/src/scheduler/task/SearchTask.cpp b/core/src/scheduler/task/SearchTask.cpp index 78e879cd7466d1a698020886df1a15fb0d9b1fd1..031d0224d98fcbf7836b319d691fb03c83d041af 100644 --- a/core/src/scheduler/task/SearchTask.cpp +++ b/core/src/scheduler/task/SearchTask.cpp @@ -127,11 +127,11 @@ XSearchTask::XSearchTask(const std::shared_ptr& context, Segmen // auto search_job = std::static_pointer_cast(job); // query::GeneralQueryPtr general_query = search_job->general_query(); // if (general_query != nullptr) { - // std::unordered_map types; + // std::unordered_map types; // auto attr_type = search_job->attr_type(); // auto type_it = attr_type.begin(); // 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_ = // EngineFactory::Build(file_->dimension_, file_->location_, engine_type, @@ -250,11 +250,11 @@ XSearchTask::Execute() { } Status s; if (general_query != nullptr) { - std::unordered_map types; + std::unordered_map types; auto attr_type = search_job->attr_type(); auto type_it = attr_type.begin(); 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();