mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 03:18:29 +08:00
enhance: change autoindex default metric type (#34277)
issue: #34304 pr: #34261 Signed-off-by: chasingegg <chao.gao@zilliz.com>
This commit is contained in:
parent
014820e9d2
commit
a60e2a65ff
@ -64,7 +64,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
FloatVectorDefaultMetricType = metric.IP
|
||||
FloatVectorDefaultMetricType = metric.COSINE
|
||||
SparseFloatVectorDefaultMetricType = metric.IP
|
||||
BinaryVectorDefaultMetricType = metric.JACCARD
|
||||
BinaryVectorDefaultMetricType = metric.HAMMING
|
||||
)
|
||||
|
@ -180,15 +180,15 @@ func Test_hnswChecker_SetDefaultMetricType(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
dType: schemapb.DataType_FloatVector,
|
||||
metricType: metric.IP,
|
||||
metricType: metric.COSINE,
|
||||
},
|
||||
{
|
||||
dType: schemapb.DataType_Float16Vector,
|
||||
metricType: metric.IP,
|
||||
metricType: metric.COSINE,
|
||||
},
|
||||
{
|
||||
dType: schemapb.DataType_BFloat16Vector,
|
||||
metricType: metric.IP,
|
||||
metricType: metric.COSINE,
|
||||
},
|
||||
{
|
||||
dType: schemapb.DataType_SparseFloatVector,
|
||||
@ -196,7 +196,7 @@ func Test_hnswChecker_SetDefaultMetricType(t *testing.T) {
|
||||
},
|
||||
{
|
||||
dType: schemapb.DataType_BinaryVector,
|
||||
metricType: metric.JACCARD,
|
||||
metricType: metric.HAMMING,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ func (p *autoIndexConfig) init(base *BaseTable) {
|
||||
p.IndexParams = ParamItem{
|
||||
Key: "autoIndex.params.build",
|
||||
Version: "2.2.0",
|
||||
DefaultValue: `{"M": 18,"efConstruction": 240,"index_type": "HNSW", "metric_type": "IP"}`,
|
||||
DefaultValue: `{"M": 18,"efConstruction": 240,"index_type": "HNSW", "metric_type": "COSINE"}`,
|
||||
Export: true,
|
||||
}
|
||||
p.IndexParams.Init(base.mgr)
|
||||
@ -86,7 +86,7 @@ func (p *autoIndexConfig) init(base *BaseTable) {
|
||||
p.BinaryIndexParams = ParamItem{
|
||||
Key: "autoIndex.params.binary.build",
|
||||
Version: "2.4.5",
|
||||
DefaultValue: `{"nlist": 1024, "index_type": "BIN_IVF_FLAT", "metric_type": "JACCARD"}`,
|
||||
DefaultValue: `{"nlist": 1024, "index_type": "BIN_IVF_FLAT", "metric_type": "HAMMING"}`,
|
||||
Export: true,
|
||||
}
|
||||
p.BinaryIndexParams.Init(base.mgr)
|
||||
|
@ -22,7 +22,8 @@ prefix = "index"
|
||||
default_schema = cf.gen_default_collection_schema()
|
||||
default_field_name = ct.default_float_vec_field_name
|
||||
default_index_params = ct.default_index
|
||||
default_autoindex_params = {"index_type": "AUTOINDEX", "metric_type": "IP"}
|
||||
default_autoindex_params = {"index_type": "AUTOINDEX", "metric_type": "COSINE"}
|
||||
default_sparse_autoindex_params = {"index_type": "AUTOINDEX", "metric_type": "IP"}
|
||||
|
||||
# copied from pymilvus
|
||||
uid = "test_index"
|
||||
@ -2125,7 +2126,7 @@ class TestAutoIndex(TestcaseBase):
|
||||
"""
|
||||
collection_w = self.init_collection_general(prefix, is_binary=True, is_index=False)[0]
|
||||
collection_w.create_index(binary_field_name, {})
|
||||
assert collection_w.index()[0].params == {'index_type': 'AUTOINDEX', 'metric_type': 'JACCARD'}
|
||||
assert collection_w.index()[0].params == {'index_type': 'AUTOINDEX', 'metric_type': 'HAMMING'}
|
||||
|
||||
|
||||
@pytest.mark.tags(CaseLabel.GPU)
|
||||
|
Loading…
Reference in New Issue
Block a user