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

Can Support 2.3.x Range Search? #245

Closed
regain0001 opened this issue Jan 11, 2024 · 4 comments
Closed

Can Support 2.3.x Range Search? #245

regain0001 opened this issue Jan 11, 2024 · 4 comments

Comments

@regain0001
Copy link

Through the latest documentation of 2.3.x, I found that milvus itself supports range search, but when I tried to use cpp sdk for range query, I found that it did not work.
My query code is as follows:
// index use HNSW
// metric type is IP
milvus::SearchArguments arguments{};
arguments.SetCollectionName(collection_name);

vectorq_vector {0.1, 0.8, 0.1, 0.1};

arguments.SetGuaranteeTimestamp(milvus::GuaranteeStrongTs());
arguments.AddTargetVector(faceField, std::move(q_vector));
arguments.SetMetricType(milvus::MetricType::IP);
arguments.AddExtraParam("radius", 0.2);
arguments.AddExtraParam("range_filter", 10.0);
arguments.AddExtraParam("ef", 10);
arguments.AddOutputField(trackIdField);
int64_t topk = arguments.TopK();
cout << "topk:" << topk << endl;

milvus::SearchResults search_results{};
status = client->Search(arguments, search_results);

I has two entities both distance within target vector is between 0.2 and 10.0,but the search result is always one,
topk output is 1,So I doubt if the default topk parameter will affect the results (according to the documentation for range queries, the topk parameter is not required for range queries)。

@matrixji
Copy link
Collaborator

How about for having a workaround by set top to a large number, e.g arguments.SetTopK(...) before do search.
Sorry for long time not maintain this project, this sdk may even not tested with the latest milvus's version(2.3)

@regain0001
Copy link
Author

if set topk set to a larger number, 10, then the result count is always 10,and some of the distances do not meet the requirements of range search. It seems that only topk plays a role.

matrixji added a commit to matrixji/milvus-sdk-cpp that referenced this issue Jan 13, 2024
matrixji added a commit to matrixji/milvus-sdk-cpp that referenced this issue Jan 13, 2024
@matrixji
Copy link
Collaborator

@regain0001 you could try latest master code, it should be fixed by #248

@regain0001
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants