Skip to content

Commit

Permalink
Not passing index type when not set
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Apr 8, 2024
1 parent 649a6db commit 270cde5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions entity/index_scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions entity/index_scalar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 270cde5

Please sign in to comment.