diff --git a/entity/index_scalar.go b/entity/index_scalar.go index c4ee802f..ffaa5de9 100644 --- a/entity/index_scalar.go +++ b/entity/index_scalar.go @@ -7,9 +7,11 @@ type indexScalar struct { } func (i *indexScalar) Params() map[string]string { - return map[string]string{ - tIndexType: string(i.baseIndex.it), + result := make(map[string]string) + if i.baseIndex.it != "" { + result[tIndexType] = string(i.baseIndex.it) } + return result } func NewScalarIndex() Index { diff --git a/entity/index_scalar_test.go b/entity/index_scalar_test.go index 6a2a6809..5442f0d3 100644 --- a/entity/index_scalar_test.go +++ b/entity/index_scalar_test.go @@ -10,6 +10,8 @@ func TestScalarIndex(t *testing.T) { oldScalarIdx := NewScalarIndex() assert.EqualValues(t, "", oldScalarIdx.IndexType(), "use AUTO index when index type not provided") + _, has := oldScalarIdx.Params()[tIndexType] + assert.False(t, has) idxWithType := NewScalarIndexWithType(Sorted)