mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
Fix get index mode error (#22364)
Signed-off-by: lixinguo <xinguo.li@zilliz.com> Co-authored-by: lixinguo <xinguo.li@zilliz.com>
This commit is contained in:
parent
872721e3ec
commit
8d05874ff9
@ -18,6 +18,7 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "index/Utils.h"
|
#include "index/Utils.h"
|
||||||
#include "index/Meta.h"
|
#include "index/Meta.h"
|
||||||
@ -127,11 +128,11 @@ GetIndexModeFromConfig(const Config& config) {
|
|||||||
|
|
||||||
IndexMode
|
IndexMode
|
||||||
GetIndexMode(const std::string index_mode) {
|
GetIndexMode(const std::string index_mode) {
|
||||||
if (index_mode.compare("CPU") != 0) {
|
if (index_mode.compare("CPU") == 0 || index_mode.compare("cpu") == 0) {
|
||||||
return IndexMode::MODE_CPU;
|
return IndexMode::MODE_CPU;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index_mode.compare("GPU") != 0) {
|
if (index_mode.compare("GPU") == 0 || index_mode.compare("gpu") == 0) {
|
||||||
return IndexMode::MODE_GPU;
|
return IndexMode::MODE_GPU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,7 +1424,7 @@ TEST(CApiTest, LoadIndexInfo) {
|
|||||||
std::string index_param_value1 = "IVF_PQ";
|
std::string index_param_value1 = "IVF_PQ";
|
||||||
status = AppendIndexParam(c_load_index_info, index_param_key1.data(), index_param_value1.data());
|
status = AppendIndexParam(c_load_index_info, index_param_key1.data(), index_param_value1.data());
|
||||||
std::string index_param_key2 = "index_mode";
|
std::string index_param_key2 = "index_mode";
|
||||||
std::string index_param_value2 = "cpu";
|
std::string index_param_value2 = "CPU";
|
||||||
status = AppendIndexParam(c_load_index_info, index_param_key2.data(), index_param_value2.data());
|
status = AppendIndexParam(c_load_index_info, index_param_key2.data(), index_param_value2.data());
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
std::string index_param_key3 = knowhere::meta::METRIC_TYPE;
|
std::string index_param_key3 = knowhere::meta::METRIC_TYPE;
|
||||||
@ -1578,7 +1578,7 @@ TEST(CApiTest, Indexing_Without_Predicate) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -1699,7 +1699,7 @@ TEST(CApiTest, Indexing_Expr_Without_Predicate) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -1837,7 +1837,7 @@ TEST(CApiTest, Indexing_With_float_Predicate_Range) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -1989,7 +1989,7 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Range) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -2125,7 +2125,7 @@ TEST(CApiTest, Indexing_With_float_Predicate_Term) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -2270,7 +2270,7 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Term) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -2408,7 +2408,7 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Range) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "BIN_IVF_FLAT";
|
std::string index_type_value = "BIN_IVF_FLAT";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "JACCARD";
|
std::string metric_type_value = "JACCARD";
|
||||||
|
|
||||||
@ -2558,7 +2558,7 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Range) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "BIN_IVF_FLAT";
|
std::string index_type_value = "BIN_IVF_FLAT";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "JACCARD";
|
std::string metric_type_value = "JACCARD";
|
||||||
|
|
||||||
@ -2695,7 +2695,7 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Term) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "BIN_IVF_FLAT";
|
std::string index_type_value = "BIN_IVF_FLAT";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "JACCARD";
|
std::string metric_type_value = "JACCARD";
|
||||||
|
|
||||||
@ -2856,7 +2856,7 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Term) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "BIN_IVF_FLAT";
|
std::string index_type_value = "BIN_IVF_FLAT";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "JACCARD";
|
std::string metric_type_value = "JACCARD";
|
||||||
|
|
||||||
@ -3016,7 +3016,7 @@ TEST(CApiTest, SealedSegment_search_float_Predicate_Range) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
@ -3295,7 +3295,7 @@ TEST(CApiTest, SealedSegment_search_float_With_Expr_Predicate_Range) {
|
|||||||
std::string index_type_key = "index_type";
|
std::string index_type_key = "index_type";
|
||||||
std::string index_type_value = "IVF_PQ";
|
std::string index_type_value = "IVF_PQ";
|
||||||
std::string index_mode_key = "index_mode";
|
std::string index_mode_key = "index_mode";
|
||||||
std::string index_mode_value = "cpu";
|
std::string index_mode_value = "CPU";
|
||||||
std::string metric_type_key = "metric_type";
|
std::string metric_type_key = "metric_type";
|
||||||
std::string metric_type_value = "L2";
|
std::string metric_type_value = "L2";
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func TestLoadIndexInfo(t *testing.T) {
|
|||||||
})
|
})
|
||||||
indexParams = append(indexParams, &commonpb.KeyValuePair{
|
indexParams = append(indexParams, &commonpb.KeyValuePair{
|
||||||
Key: "index_mode",
|
Key: "index_mode",
|
||||||
Value: "cpu",
|
Value: "CPU",
|
||||||
})
|
})
|
||||||
indexParams = append(indexParams, &commonpb.KeyValuePair{
|
indexParams = append(indexParams, &commonpb.KeyValuePair{
|
||||||
Key: "metric_type",
|
Key: "metric_type",
|
||||||
|
Loading…
Reference in New Issue
Block a user