Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/src/v2/add_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ CreateCollection(milvus::MilvusClientV2Ptr& client) {
milvus::CreateCollectionRequest().WithCollectionName(collection_name).WithCollectionSchema(collection_schema));
util::CheckStatus("create collection: " + collection_name, status);

milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

status = client->LoadCollection(milvus::LoadCollectionRequest().WithCollectionName(collection_name));
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
12 changes: 6 additions & 6 deletions examples/src/v2/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create indexes
milvus::IndexDesc index_vector(field_face, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexDesc index_varchar(field_name, "", milvus::IndexType::TRIE);
milvus::IndexDesc index_sort(field_age, "", milvus::IndexType::STL_SORT);
milvus::IndexParam index_vector(field_face, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_varchar(field_name, "", milvus::IndexType::TRIE);
milvus::IndexParam index_sort(field_age, "", milvus::IndexType::STL_SORT);
status = client->CreateIndex(milvus::CreateIndexRequest()
.WithCollectionName(collection_name)
.AddIndex(std::move(index_vector))
.AddIndex(std::move(index_varchar))
.AddIndex(std::move(index_sort)));
.AddIndexParam(std::move(index_vector))
.AddIndexParam(std::move(index_varchar))
.AddIndexParam(std::move(index_sort)));
util::CheckStatus("create indexes on collection", status);

// create a partition
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/default_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create partition: " + partition_2, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
8 changes: 4 additions & 4 deletions examples/src/v2/dml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ buildCollection(milvus::MilvusClientV2Ptr& client, bool auto_id) {
util::CheckStatus("create collection: " + std::string(collection_name), status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
index_vector.AddExtraParam("M", "64");
index_vector.AddExtraParam("efConstruction", "200");
milvus::IndexDesc index_text(field_text, "", milvus::IndexType::INVERTED);
milvus::IndexParam index_text(field_text, "", milvus::IndexType::INVERTED);
status = client->CreateIndex(milvus::CreateIndexRequest()
.WithCollectionName(collection_name)
.AddIndex(std::move(index_vector))
.AddIndex(std::move(index_text)));
.AddIndexParam(std::move(index_vector))
.AddIndexParam(std::move(index_text)));
util::CheckStatus("create indexes on collection", status);

// load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/dynamic_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::IVF_SQ8, milvus::MetricType::IP);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::IVF_SQ8, milvus::MetricType::IP);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
2 changes: 1 addition & 1 deletion examples/src/v2/external_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ verifyData(milvus::MilvusClientV2Ptr& client) {
auto status = client->CreateIndex(
milvus::CreateIndexRequest()
.WithCollectionName(collection_name)
.AddIndex(milvus::IndexDesc(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::L2)));
.AddIndexParam(milvus::IndexParam(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::L2)));
util::CheckStatus("create index on vector field", status);

status = client->LoadCollection(milvus::LoadCollectionRequest().WithCollectionName(collection_name));
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/filter_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::L2);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::L2);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/full_text_match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ buildCollection(milvus::MilvusClientV2Ptr& client) {
util::CheckStatus(std::string("create collection: ") + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::SPARSE_INVERTED_INDEX,
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::SPARSE_INVERTED_INDEX,
milvus::MetricType::BM25);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/function_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ buildCollection(milvus::MilvusClientV2Ptr& client) {
util::CheckStatus(std::string("create collection: ") + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
16 changes: 8 additions & 8 deletions examples/src/v2/general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ main(int argc, char* argv[]) {
milvus::FieldSchema(field_face, milvus::DataType::FLOAT_VECTOR, "face signature").WithDimension(dimension));

// define indexes
milvus::IndexDesc index_vector(field_face, "", milvus::IndexType::IVF_FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_vector(field_face, "", milvus::IndexType::IVF_FLAT, milvus::MetricType::COSINE);
index_vector.AddExtraParam(milvus::NLIST, "100");
milvus::IndexDesc index_sort(field_age, "", milvus::IndexType::STL_SORT);
milvus::IndexDesc index_varchar(field_name, "", milvus::IndexType::TRIE);
milvus::IndexParam index_sort(field_age, "", milvus::IndexType::STL_SORT);
milvus::IndexParam index_varchar(field_name, "", milvus::IndexType::TRIE);

// drop collection if it exists, the CreateCollectionRequest with indexes will automatically create indexes
// for this collection and load the collection
Expand All @@ -149,9 +149,9 @@ main(int argc, char* argv[]) {
.WithDescription("my collection")
.WithNumShards(1)
.WithCollectionSchema(collection_schema)
.AddIndex(std::move(index_vector))
.AddIndex(std::move(index_sort))
.AddIndex(std::move(index_varchar))
.AddIndexParam(std::move(index_vector))
.AddIndexParam(std::move(index_sort))
.AddIndexParam(std::move(index_varchar))
.AddProperty("my_prop", "dummy") // add a customized property
.AddProperty(milvus::COLLECTION_TTL_SECONDS, "60") // configure a built-in property
.WithConsistencyLevel(milvus::ConsistencyLevel::STRONG));
Expand Down Expand Up @@ -404,15 +404,15 @@ main(int argc, char* argv[]) {

// create index again
{
milvus::IndexDesc index_vector(field_face, "vector_index_name", milvus::IndexType::HNSW,
milvus::IndexParam index_vector(field_face, "vector_index_name", milvus::IndexType::HNSW,
milvus::MetricType::L2);
index_vector.AddExtraParam("M", "32");
index_vector.AddExtraParam("efConstruction", "100");

status = client->CreateIndex(milvus::CreateIndexRequest()
.WithCollectionName(collection_name)
.WithSync(true)
.AddIndex(std::move(index_vector)));
.AddIndexParam(std::move(index_vector)));
util::CheckStatus("rebuild index for field: " + field_face, status);

status = client->AlterIndexProperties(milvus::AlterIndexPropertiesRequest()
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/geometry_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + std::string(collection_name), status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/group_by.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
6 changes: 3 additions & 3 deletions examples/src/v2/highlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ createCollection(milvus::MilvusClientV2Ptr& client) {
collection_schema->AddFunction(function);

auto status = client->DropCollection(milvus::DropCollectionRequest().WithCollectionName(collection_name));
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::SPARSE_INVERTED_INDEX,
milvus::MetricType::BM25);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::SPARSE_INVERTED_INDEX,
milvus::MetricType::BM25);
status = client->CreateCollection(milvus::CreateCollectionRequest()
.WithCollectionName(collection_name)
.WithCollectionSchema(collection_schema)
.AddIndex(std::move(index_vector))
.AddIndexParam(std::move(index_vector))
.WithConsistencyLevel(milvus::ConsistencyLevel::BOUNDED));
util::CheckStatus(std::string("create collection: ") + collection_name, status);

Expand Down
8 changes: 4 additions & 4 deletions examples/src/v2/hybrid_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
std::vector<milvus::IndexDesc> indexes = {
milvus::IndexDesc(field_dense, "", milvus::IndexType::DISKANN, milvus::MetricType::COSINE),
milvus::IndexDesc(field_sparse, "", milvus::IndexType::SPARSE_INVERTED_INDEX, milvus::MetricType::IP)};
std::vector<milvus::IndexParam> indexes = {
milvus::IndexParam(field_dense, "", milvus::IndexType::DISKANN, milvus::MetricType::COSINE),
milvus::IndexParam(field_sparse, "", milvus::IndexType::SPARSE_INVERTED_INDEX, milvus::MetricType::IP)};
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).WithIndexes(std::move(indexes)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).WithIndexParams(std::move(indexes)));
util::CheckStatus("create indexes on collection", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/iterator_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_face, "", milvus::IndexType::AUTOINDEX, milvus::MetricType::L2);
milvus::IndexParam index_vector(field_face, "", milvus::IndexType::AUTOINDEX, milvus::MetricType::L2);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/iterator_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ buildCollection(milvus::MilvusClientV2Ptr& client, milvus::MetricType index_metr

// create index
// Note that we use FLAT here, because other indexes cannot ensure that all entities can be featched by iterator
milvus::IndexDesc index_vector(field_face, "", milvus::IndexType::FLAT, index_metric);
milvus::IndexParam index_vector(field_face, "", milvus::IndexType::FLAT, index_metric);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create collection: " + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::FLAT, milvus::MetricType::COSINE);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/minhash_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ createDedupCollection(milvus::MilvusClientV2Ptr& client) {
milvus::CreateCollectionRequest().WithCollectionName(collection_name).WithCollectionSchema(schema));
util::CheckStatus(std::string("create collection: ") + collection_name, status);

milvus::IndexDesc index(signature_field, "", milvus::IndexType::MINHASH_LSH, milvus::MetricType::MHJACCARD);
milvus::IndexParam index(signature_field, "", milvus::IndexType::MINHASH_LSH, milvus::MetricType::MHJACCARD);
index.AddExtraParam("mh_lsh_band", "8");
index.AddExtraParam("with_raw_data", "true");
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index)));
util::CheckStatus("create index on MinHash signature field", status);

status = client->LoadCollection(milvus::LoadCollectionRequest().WithCollectionName(collection_name));
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/multi_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ buildCollection(milvus::MilvusClientV2Ptr& client) {
util::CheckStatus(std::string("create collection: ") + collection_name, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::SPARSE_INVERTED_INDEX,
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::SPARSE_INVERTED_INDEX,
milvus::MetricType::BM25);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
4 changes: 2 additions & 2 deletions examples/src/v2/nullable_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ main(int argc, char* argv[]) {
util::CheckStatus("create partition: " + partition_2, status);

// create index
milvus::IndexDesc index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
milvus::IndexParam index_vector(field_vector, "", milvus::IndexType::HNSW, milvus::MetricType::L2);
status = client->CreateIndex(
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndex(std::move(index_vector)));
milvus::CreateIndexRequest().WithCollectionName(collection_name).AddIndexParam(std::move(index_vector)));
util::CheckStatus("create index on vector field", status);

// tell server prepare to load collection
Expand Down
Loading
Loading