From 649a6dbfeacf99236dd01ee3a8d34f3c793fa0b5 Mon Sep 17 00:00:00 2001 From: Congqi Xia Date: Wed, 3 Apr 2024 15:52:24 +0800 Subject: [PATCH] fix: Pass index type for Scalar indexes Related to #694 #695 Signed-off-by: Congqi Xia --- entity/index_scalar.go | 4 +++- entity/index_scalar_test.go | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/entity/index_scalar.go b/entity/index_scalar.go index a8c43a4a..c4ee802f 100644 --- a/entity/index_scalar.go +++ b/entity/index_scalar.go @@ -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 { diff --git a/entity/index_scalar_test.go b/entity/index_scalar_test.go index 4107e8ff..6a2a6809 100644 --- a/entity/index_scalar_test.go +++ b/entity/index_scalar_test.go @@ -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]) }