github.com/milvus-io/milvus-sdk-go/v2@v2.4.1/entity/index_scalar_test.go (about)

     1  package entity
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestScalarIndex(t *testing.T) {
    10  	oldScalarIdx := NewScalarIndex()
    11  
    12  	assert.EqualValues(t, "", oldScalarIdx.IndexType(), "use AUTO index when index type not provided")
    13  	_, has := oldScalarIdx.Params()[tIndexType]
    14  	assert.False(t, has)
    15  
    16  	idxWithType := NewScalarIndexWithType(Sorted)
    17  
    18  	assert.EqualValues(t, Sorted, idxWithType.IndexType())
    19  	assert.EqualValues(t, Sorted, idxWithType.Params()[tIndexType])
    20  
    21  	idxWithType = NewScalarIndexWithType(Trie)
    22  
    23  	assert.EqualValues(t, Trie, idxWithType.IndexType())
    24  	assert.EqualValues(t, Trie, idxWithType.Params()[tIndexType])
    25  }