@@ -1229,9 +1229,9 @@ void SetUpCreateRegion(CLI::App &app) {
1229
1229
cmd->add_flag (" --use_json_parameter" , opt->use_json_parameter , " Request parameter use_json_parameter swtich" );
1230
1230
cmd->add_flag (" --key_is_hex" , opt->key_is_hex , " Request parameter key_is_hex" );
1231
1231
cmd->add_option (" --vector_index_type" , opt->vector_index_type ,
1232
- " Request parameter vector_index_type, hnsw|flat|ivf_flat|ivf_pq" );
1232
+ " Request parameter vector_index_type, hnsw|flat|ivf_flat|ivf_pq|binary_Flat|binary_ivf_flat " );
1233
1233
cmd->add_option (" --dimension" , opt->dimension , " Request parameter dimension" );
1234
- cmd->add_option (" --metrics_type" , opt->metrics_type , " Request parameter metrics_type, L2|IP|COSINE" )->ignore_case ();
1234
+ cmd->add_option (" --metrics_type" , opt->metrics_type , " Request parameter metrics_type, L2|IP|COSINE|HAMMING " )->ignore_case ();
1235
1235
cmd->add_option (" --max_elements" , opt->max_elements , " Request parameter max_elements" );
1236
1236
cmd->add_option (" --efconstruction" , opt->efconstruction , " Request parameter efconstruction" );
1237
1237
cmd->add_option (" --nlinks" , opt->nlinks , " Request parameter nlinks" );
@@ -1404,6 +1404,12 @@ void RunCreateRegion(CreateRegionOption const &opt) {
1404
1404
vector_index_parameter->set_vector_index_type (::dingodb::pb::common::VectorIndexType::VECTOR_INDEX_TYPE_IVF_FLAT);
1405
1405
} else if (opt.vector_index_type == " ivf_pq" ) {
1406
1406
vector_index_parameter->set_vector_index_type (::dingodb::pb::common::VectorIndexType::VECTOR_INDEX_TYPE_IVF_PQ);
1407
+ } else if (opt.vector_index_type == " binary_flat" ) {
1408
+ vector_index_parameter->set_vector_index_type (
1409
+ ::dingodb::pb::common::VectorIndexType::VECTOR_INDEX_TYPE_BINARY_FLAT);
1410
+ } else if (opt.vector_index_type == " binary_ivf_flat" ) {
1411
+ vector_index_parameter->set_vector_index_type (
1412
+ ::dingodb::pb::common::VectorIndexType::VECTOR_INDEX_TYPE_BINARY_IVF_FLAT);
1407
1413
} else {
1408
1414
DINGO_LOG (WARNING) << " vector_index_type is invalid, now only support hnsw and flat" ;
1409
1415
return ;
@@ -1425,8 +1431,10 @@ void RunCreateRegion(CreateRegionOption const &opt) {
1425
1431
metric_type = ::dingodb::pb::common::MetricType::METRIC_TYPE_INNER_PRODUCT;
1426
1432
} else if (opt.metrics_type == " COSINE" || opt.metrics_type == " cosine" ) {
1427
1433
metric_type = ::dingodb::pb::common::MetricType::METRIC_TYPE_COSINE;
1434
+ } else if (opt.metrics_type == " HAMMING" || opt.metrics_type == " hamming" ) {
1435
+ metric_type = ::dingodb::pb::common::MetricType::METRIC_TYPE_HAMMING;
1428
1436
} else {
1429
- DINGO_LOG (WARNING) << " metrics_type is invalid, now only support L2, IP and COSINE " ;
1437
+ DINGO_LOG (WARNING) << " metrics_type is invalid, now only support L2, IP, COSINE and HAMMING " ;
1430
1438
return ;
1431
1439
}
1432
1440
@@ -1469,6 +1477,15 @@ void RunCreateRegion(CreateRegionOption const &opt) {
1469
1477
ivf_pq_index_parameter->set_ncentroids (opt.ncentroids );
1470
1478
ivf_pq_index_parameter->set_nsubvector (opt.nsubvector );
1471
1479
ivf_pq_index_parameter->set_nbits_per_idx (opt.nbits_per_idx );
1480
+ } else if (opt.vector_index_type == " binary_flat" ) {
1481
+ auto *binary_flat_parameter = vector_index_parameter->mutable_binary_flat_parameter ();
1482
+ binary_flat_parameter->set_metric_type (metric_type);
1483
+ binary_flat_parameter->set_dimension (opt.dimension );
1484
+ }else if (opt.vector_index_type ==" binary_ivf_flat" ) {
1485
+ auto *binary_ivf_flat_parameter = vector_index_parameter->mutable_binary_ivf_flat_parameter ();
1486
+ binary_ivf_flat_parameter->set_metric_type (metric_type);
1487
+ binary_ivf_flat_parameter->set_dimension (opt.dimension );
1488
+ binary_ivf_flat_parameter->set_ncentroids (opt.ncentroids );
1472
1489
}
1473
1490
}
1474
1491
0 commit comments