Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: [GoSDK] Range search params configured via WithSearchParam does not seem to work #38846

Open
1 task done
ThreadDao opened this issue Dec 30, 2024 · 1 comment
Open
1 task done
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@ThreadDao
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: master-20241227-445b9379-amd64
- Deployment mode(standalone or cluster):
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): go sdk v2 
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

  • search with range params but the search scores doesn't meet the range: (radius=10, range_filter=30)
    search_test.go:1122: 
        	Error Trace:	/home/zong/zong/projects/milvus/tests/go_client/testcases/search_test.go:1122
        	Error:      	"30.964611" is not less than "30"
        	Test:       	TestRangeSearchSparseVector
  • results
default search scores:
[2024/12/30 15:42:48.148 +08:00] [INFO] [testcases/search_test.go:1103] ["default search"] [score="[30.964611,30.618275,30.260593,29.937754,29.834946,29.819975,29.45387,29.339054,29.321682,29.156536]"]
[2024/12/30 15:42:48.148 +08:00] [INFO] [testcases/search_test.go:1103] ["default search"] [score="[28.851183,28.641346,28.474401,28.269678,27.877518,27.77828,27.771084,27.635157,27.50377,27.370735]"]
[2024/12/30 15:42:48.148 +08:00] [INFO] [testcases/search_test.go:1103] ["default search"] [score="[34.471928,33.063526,32.974804,32.94745,32.912514,32.91202,32.809494,32.7819,32.76309,32.478886]"]
[2024/12/30 15:42:48.148 +08:00] [INFO] [testcases/search_test.go:1103] ["default search"] [score="[35.661522,34.14397,33.949726,33.931587,33.831593,33.7857,33.734726,33.61877,33.51331,33.201366]"]
[2024/12/30 15:42:48.149 +08:00] [INFO] [testcases/search_test.go:1103] ["default search"] [score="[20.891726,20.69407,19.612488,19.470243,19.433949,19.392069,19.384956,19.361885,19.357288,19.351835]"]

range search scores: 
[2024/12/30 15:42:48.163 +08:00] [INFO] [testcases/search_test.go:1116] ["range search"] [score="[30.964611,30.618275,30.260593,29.937754,29.834946,29.819975,29.45387,29.339054,29.321682,29.156536]"]
[2024/12/30 15:42:48.163 +08:00] [INFO] [testcases/search_test.go:1116] ["range search"] [score="[28.851183,28.641346,28.474401,28.269678,27.877518,27.77828,27.771084,27.635157,27.50377,27.370735]"]
[2024/12/30 15:42:48.164 +08:00] [INFO] [testcases/search_test.go:1116] ["range search"] [score="[34.471928,33.063526,32.974804,32.94745,32.912514,32.91202,32.809494,32.7819,32.76309,32.478886]"]
[2024/12/30 15:42:48.164 +08:00] [INFO] [testcases/search_test.go:1116] ["range search"] [score="[35.661522,34.14397,33.949726,33.931587,33.831593,33.7857,33.734726,33.61877,33.51331,33.201366]"]
[2024/12/30 15:42:48.164 +08:00] [INFO] [testcases/search_test.go:1116] ["range search"] [score="[20.891726,20.69407,19.612488,19.470243,19.433949,19.392069,19.384956,19.361885,19.357288,19.351835]"]
  • case:
func TestRangeSearchSparseVector(t *testing.T) {
	//t.Skip("Waiting for support range search")
	ctx := hp.CreateContext(t, time.Second*common.DefaultTimeout*2)
	mc := createDefaultMilvusClient(ctx, t)

	prepare, schema := hp.CollPrepare.CreateCollection(ctx, t, mc, hp.NewCreateCollectionParams(hp.Int64VarcharSparseVec), hp.TNewFieldsOption(), hp.TNewSchemaOption().
		TWithEnableDynamicField(true))
	prepare.CreateIndex(ctx, t, mc, hp.TNewIndexParams(schema))
	prepare.Load(ctx, t, mc, hp.NewLoadParams(schema.CollectionName))
	prepare.InsertData(ctx, t, mc, hp.NewInsertParams(schema), hp.TNewDataOption().TWithSparseMaxLen(128))
	prepare.FlushData(ctx, t, mc, schema.CollectionName)

	// range search
	queryVec := hp.GenSearchVectors(common.DefaultNq, common.DefaultDim, entity.FieldTypeSparseVector)

	resRange, errSearch := mc.Search(ctx, client.NewSearchOption(schema.CollectionName, common.DefaultLimit, queryVec).WithSearchParam("drop_ratio_search", "0.2"))
	common.CheckErr(t, errSearch, true)
	require.Len(t, resRange, common.DefaultNq)
	for _, res := range resRange {
		log.Info("default search", zap.Any("score", res.Scores))
	}

	radius := 10
	rangeFilter := 30
	resRange, errSearch = mc.Search(ctx, client.NewSearchOption(schema.CollectionName, common.DefaultLimit, queryVec).
		WithSearchParam("drop_ratio_search", "0.2").WithSearchParam("radius", strconv.Itoa(radius)).WithSearchParam("range_filter", strconv.Itoa(rangeFilter)))
	common.CheckErr(t, errSearch, true)
	common.CheckErr(t, errSearch, true)
	require.Len(t, resRange, common.DefaultNq)
	for _, res := range resRange {
		log.Info("range search", zap.Any("score", res.Scores))
	}
	for _, res := range resRange {
		for _, s := range res.Scores {
			log.Debug("aaa", zap.Float32("score", s))
			require.GreaterOrEqual(t, s, float32(10))
			require.Less(t, s, float32(30))
		}
	}
}

Expected Behavior

No response

Steps To Reproduce

zong-go-go-milvus-standalone-5757bdf6f6-p6hw9

Milvus Log

No response

Anything else?

No response

@ThreadDao ThreadDao added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 30, 2024
@ThreadDao ThreadDao added this to the 2.5.2 milestone Dec 30, 2024
@yanliang567
Copy link
Contributor

yanliang567 commented Dec 30, 2024

/unassign

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 30, 2024
@yanliang567 yanliang567 removed their assignment Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants