Closed regain0001 closed 7 months ago
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)
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.
@regain0001 you could try latest master code, it should be fixed by #248
thanks
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)。