未验证 提交 a8925ca6 编写于 作者: S shengjun.li 提交者: GitHub

[skip ci]fix sdk simple (#3520)

Signed-off-by: Nshengjun.li <shengjun.li@zilliz.com>
上级 013a1f0e
...@@ -30,11 +30,11 @@ constexpr milvus::MetricType COLLECTION_METRIC_TYPE = milvus::MetricType::L2; ...@@ -30,11 +30,11 @@ constexpr milvus::MetricType COLLECTION_METRIC_TYPE = milvus::MetricType::L2;
constexpr int64_t BATCH_ENTITY_COUNT = 10000; constexpr int64_t BATCH_ENTITY_COUNT = 10000;
constexpr int64_t NQ = 5; constexpr int64_t NQ = 5;
constexpr int64_t TOP_K = 10; constexpr int64_t TOP_K = 10;
constexpr int64_t NPROBE = 32; constexpr int64_t NPROBE = 16;
constexpr int64_t SEARCH_TARGET = BATCH_ENTITY_COUNT / 2; // change this value, result is different constexpr int64_t SEARCH_TARGET = BATCH_ENTITY_COUNT / 2; // change this value, result is different
constexpr int64_t ADD_ENTITY_LOOP = 10; constexpr int64_t ADD_ENTITY_LOOP = 10;
constexpr milvus::IndexType INDEX_TYPE = milvus::IndexType::IVFFLAT; constexpr milvus::IndexType INDEX_TYPE = milvus::IndexType::IVFFLAT;
constexpr int32_t NLIST = 16384; constexpr int32_t NLIST = 1024;
const char* PARTITION_TAG = "part"; const char* PARTITION_TAG = "part";
const char* DIMENSION = "dim"; const char* DIMENSION = "dim";
const char* METRICTYPE = "metric_type"; const char* METRICTYPE = "metric_type";
...@@ -114,6 +114,7 @@ ClientTest::CreateCollection(const std::string& collection_name) { ...@@ -114,6 +114,7 @@ ClientTest::CreateCollection(const std::string& collection_name) {
JSON extra_params; JSON extra_params;
extra_params["segment_row_count"] = 1024; extra_params["segment_row_count"] = 1024;
extra_params["auto_id"] = false;
milvus::Mapping mapping = {collection_name, {field_ptr1, field_ptr2, field_ptr3, field_ptr4}}; milvus::Mapping mapping = {collection_name, {field_ptr1, field_ptr2, field_ptr3, field_ptr4}};
milvus::Status stat = conn_->CreateCollection(mapping, extra_params.dump()); milvus::Status stat = conn_->CreateCollection(mapping, extra_params.dump());
...@@ -140,7 +141,6 @@ ClientTest::InsertEntities(const std::string& collection_name) { ...@@ -140,7 +141,6 @@ ClientTest::InsertEntities(const std::string& collection_name) {
milvus_sdk::Utils::BuildEntities(begin_index, begin_index + BATCH_ENTITY_COUNT, field_value, entity_ids, milvus_sdk::Utils::BuildEntities(begin_index, begin_index + BATCH_ENTITY_COUNT, field_value, entity_ids,
COLLECTION_DIMENSION); COLLECTION_DIMENSION);
} }
entity_ids.clear();
milvus::Status status = conn_->Insert(collection_name, "", field_value, entity_ids); milvus::Status status = conn_->Insert(collection_name, "", field_value, entity_ids);
search_id_array_.emplace_back(entity_ids[10]); search_id_array_.emplace_back(entity_ids[10]);
std::cout << "InsertEntities function call status: " << status.message() << std::endl; std::cout << "InsertEntities function call status: " << status.message() << std::endl;
...@@ -335,7 +335,7 @@ ClientTest::Test() { ...@@ -335,7 +335,7 @@ ClientTest::Test() {
InsertEntities(collection_name); InsertEntities(collection_name);
Flush(collection_name); Flush(collection_name);
CountEntities(collection_name); CountEntities(collection_name);
CreateIndex(collection_name, 1024); CreateIndex(collection_name, NLIST);
GetCollectionInfo(collection_name); GetCollectionInfo(collection_name);
// GetCollectionStats(collection_name); // GetCollectionStats(collection_name);
// //
...@@ -355,5 +355,5 @@ ClientTest::Test() { ...@@ -355,5 +355,5 @@ ClientTest::Test() {
// entities // entities
// //
// DropIndex(collection_name, "field_vec", "index_3"); // DropIndex(collection_name, "field_vec", "index_3");
// DropCollection(collection_name); DropCollection(collection_name);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册