From 20a801464436ee9838046956991958623c90b72d Mon Sep 17 00:00:00 2001 From: Congqi Xia Date: Wed, 10 Apr 2024 17:52:42 +0800 Subject: [PATCH] Fix hybrid search case and response check Signed-off-by: Congqi Xia --- test/common/response_check.go | 1 + test/testcases/hybrid_search_test.go | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/common/response_check.go b/test/common/response_check.go index 1b7a36a4..1db4d805 100644 --- a/test/common/response_check.go +++ b/test/common/response_check.go @@ -16,6 +16,7 @@ func CheckErr(t *testing.T, actualErr error, expErrNil bool, expErrorMsg ...stri if expErrNil { require.NoError(t, actualErr) } else { + require.Error(t, actualErr) switch len(expErrorMsg) { case 0: log.Fatal("expect error message should not be empty") diff --git a/test/testcases/hybrid_search_test.go b/test/testcases/hybrid_search_test.go index 03472c6b..36989271 100644 --- a/test/testcases/hybrid_search_test.go +++ b/test/testcases/hybrid_search_test.go @@ -4,6 +4,7 @@ package testcases import ( "fmt" + "log" "testing" "time" @@ -188,17 +189,18 @@ func TestHybridSearchInvalidVectors(t *testing.T) { // hybrid search with invalid limit ranker := client.NewRRFReranker() sp, _ := entity.NewIndexFlatSearchParam() - queryVecNq := common.GenSearchVectors(common.DefaultNq, common.DefaultDim, entity.FieldTypeFloatVector) + // queryVecNq := common.GenSearchVectors(common.DefaultNq, common.DefaultDim, entity.FieldTypeFloatVector) queryVecBinary := common.GenSearchVectors(1, common.DefaultDim, entity.FieldTypeBinaryVector) queryVecType := common.GenSearchVectors(1, common.DefaultDim, entity.FieldTypeFloat16Vector) queryVecDim := common.GenSearchVectors(1, common.DefaultDim*2, entity.FieldTypeFloatVector) sReqs := [][]*client.ANNSearchRequest{ - {client.NewANNSearchRequest(common.DefaultFloatVecFieldName, entity.L2, "", queryVecNq, sp, common.DefaultTopK)}, // nq != 1 + // {client.NewANNSearchRequest(common.DefaultFloatVecFieldName, entity.L2, "", queryVecNq, sp, common.DefaultTopK)}, // nq != 1 {client.NewANNSearchRequest(common.DefaultFloatVecFieldName, entity.L2, "", queryVecType, sp, common.DefaultTopK)}, // TODO vector type not match {client.NewANNSearchRequest(common.DefaultFloatVecFieldName, entity.L2, "", queryVecDim, sp, common.DefaultTopK)}, // vector dim not match {client.NewANNSearchRequest(common.DefaultBinaryVecFieldName, entity.JACCARD, "", queryVecBinary, sp, common.DefaultTopK)}, // not exist vector types } - for _, invalidSReq := range sReqs { + for idx, invalidSReq := range sReqs { + log.Println(idx) _, errSearch := mc.HybridSearch(ctx, collName, []string{}, common.DefaultTopK, []string{}, ranker, invalidSReq) common.CheckErr(t, errSearch, false, "nq should be equal to 1", "vector dimension mismatch", "failed to get field schema by name", "vector type must be the same")