From c0e781072ecaaa25591838d79f18fa067224b949 Mon Sep 17 00:00:00 2001 From: foxspy Date: Tue, 31 Dec 2024 16:28:53 +0800 Subject: [PATCH] fix: [2.4] enable mmap for sparse index (#38849) issue: #29419 /kind branch-feature Signed-off-by: xianliang.li --- pkg/util/indexparamcheck/index_type.go | 4 +++- pkg/util/indexparamcheck/index_type_test.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/util/indexparamcheck/index_type.go b/pkg/util/indexparamcheck/index_type.go index b095f6135e2fc..efe4bbbc7375a 100644 --- a/pkg/util/indexparamcheck/index_type.go +++ b/pkg/util/indexparamcheck/index_type.go @@ -68,7 +68,9 @@ func IsVectorMmapIndex(indexType IndexType) bool { indexType == IndexFaissBinIDMap || indexType == IndexFaissBinIvfFlat || indexType == IndexHNSW || - indexType == IndexScaNN + indexType == IndexScaNN || + indexType == IndexSparseInverted || + indexType == IndexSparseWand } func IsDiskIndex(indexType IndexType) bool { diff --git a/pkg/util/indexparamcheck/index_type_test.go b/pkg/util/indexparamcheck/index_type_test.go index 29d77eace5488..eaf3b3cb8df9d 100644 --- a/pkg/util/indexparamcheck/index_type_test.go +++ b/pkg/util/indexparamcheck/index_type_test.go @@ -35,6 +35,8 @@ func TestIsScalarMmapIndex(t *testing.T) { func TestIsVectorMmapIndex(t *testing.T) { t.Run("vector index", func(t *testing.T) { assert.True(t, IsVectorMmapIndex(IndexFaissIDMap)) + assert.True(t, IsVectorMmapIndex(IndexSparseInverted)) + assert.True(t, IsVectorMmapIndex(IndexSparseWand)) assert.False(t, IsVectorMmapIndex(IndexINVERTED)) }) }