Skip to content

Commit

Permalink
fix: Pass index type for Scalar indexes
Browse files Browse the repository at this point in the history
Related to #694 #695

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Apr 8, 2024
1 parent 59ff80c commit 649a6db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion entity/index_scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ type indexScalar struct {
}

func (i *indexScalar) Params() map[string]string {
return map[string]string{}
return map[string]string{
tIndexType: string(i.baseIndex.it),
}
}

func NewScalarIndex() Index {
Expand Down
6 changes: 6 additions & 0 deletions entity/index_scalar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ func TestScalarIndex(t *testing.T) {
idxWithType := NewScalarIndexWithType(Sorted)

assert.EqualValues(t, Sorted, idxWithType.IndexType())
assert.EqualValues(t, Sorted, idxWithType.Params()[tIndexType])

idxWithType = NewScalarIndexWithType(Trie)

assert.EqualValues(t, Trie, idxWithType.IndexType())
assert.EqualValues(t, Trie, idxWithType.Params()[tIndexType])
}

0 comments on commit 649a6db

Please sign in to comment.