fix: lack good results for insufficient ef(#29883) (#32080)

related: #29883

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
This commit is contained in:
Chun Han 2024-04-13 22:13:23 +08:00 committed by GitHub
parent aa96843d31
commit 337cc0756d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 16 additions and 12 deletions

View File

@ -419,10 +419,9 @@ VectorDiskAnnIndex<T>::Query(const DatasetPtr dataset,
template <typename T>
knowhere::expected<std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
VectorDiskAnnIndex<T>::VectorIterators(const DatasetPtr dataset,
const SearchInfo& search_info,
const knowhere::Json& conf,
const BitsetView& bitset) const {
return this->index_.AnnIterator(
*dataset, search_info.search_params_, bitset);
return this->index_.AnnIterator(*dataset, conf, bitset);
}
template <typename T>

View File

@ -109,7 +109,7 @@ class VectorDiskAnnIndex : public VectorIndex {
knowhere::expected<
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
VectorIterators(const DatasetPtr dataset,
const SearchInfo& search_info,
const knowhere::Json& json,
const BitsetView& bitset) const override;
private:

View File

@ -63,7 +63,7 @@ class VectorIndex : public IndexBase {
virtual knowhere::expected<
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
VectorIterators(const DatasetPtr dataset,
const SearchInfo& search_info,
const knowhere::Json& json,
const BitsetView& bitset) const {
throw std::runtime_error("VectorIndex:" + this->GetIndexType() +
" didn't implement VectorIterator interface, "

View File

@ -150,10 +150,9 @@ VectorMemIndex<T>::UploadV2(const Config& config) {
template <typename T>
knowhere::expected<std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
VectorMemIndex<T>::VectorIterators(const milvus::DatasetPtr dataset,
const milvus::SearchInfo& search_info,
const knowhere::Json& conf,
const milvus::BitsetView& bitset) const {
return this->index_.AnnIterator(
*dataset, search_info.search_params_, bitset);
return this->index_.AnnIterator(*dataset, conf, bitset);
}
template <typename T>

View File

@ -97,7 +97,7 @@ class VectorMemIndex : public VectorIndex {
knowhere::expected<
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
VectorIterators(const DatasetPtr dataset,
const SearchInfo& search_info,
const knowhere::Json& json,
const BitsetView& bitset) const override;
protected:

View File

@ -132,10 +132,15 @@ PrepareVectorIteratorsFromIndex(const SearchInfo& search_info,
const index::VectorIndex& index) {
if (search_info.group_by_field_id_.has_value()) {
try {
auto search_conf = search_info.search_params_;
if (search_conf.contains(knowhere::indexparam::EF)) {
search_conf[knowhere::indexparam::SEED_EF] =
search_conf[knowhere::indexparam::EF];
}
knowhere::expected<
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
iterators_val =
index.VectorIterators(dataset, search_info, bitset);
index.VectorIterators(dataset, search_conf, bitset);
if (iterators_val.has_value()) {
search_result.AssembleChunkVectorIterators(
nq, 1, -1, iterators_val.value());

View File

@ -466,7 +466,8 @@ TEST(Indexing, Iterator) {
knowhere::expected<
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
kw_iterators = vec_index->VectorIterators(query_ds, searchInfo, view);
kw_iterators = vec_index->VectorIterators(
query_ds, searchInfo.search_params_, view);
ASSERT_TRUE(kw_iterators.has_value());
ASSERT_EQ(kw_iterators.value().size(), 1);
auto iterator = kw_iterators.value()[0];

View File

@ -9973,7 +9973,7 @@ class TestSearchIterator(TestcaseBase):
class TestSearchGroupBy(TestcaseBase):
""" Test case of search group by """
@pytest.mark.tags(CaseLabel.L0)
@pytest.mark.tags(CaseLabel.L3)
@pytest.mark.parametrize("index_type, metric", zip(["FLAT", "IVF_FLAT", "HNSW"], ct.float_metrics))
@pytest.mark.parametrize("vector_data_type", ["FLOAT16_VECTOR", "FLOAT_VECTOR", "BFLOAT16_VECTOR"])
def test_search_group_by_default(self, index_type, metric, vector_data_type):