diff --git a/tests/search/bm25_test.cpp b/tests/search/bm25_test.cpp index b51f93143..408ac98da 100644 --- a/tests/search/bm25_test.cpp +++ b/tests/search/bm25_test.cpp @@ -970,8 +970,9 @@ TEST_P(bm25_test_case, test_query) { EXPECT_GT(counter.max, 0); counter.Reset(); + // by_range single + scored_terms_limit(0) // by_range single + scored_terms_limit(1) - { + for (size_t limit = 0; limit != 2; ++limit) { auto values = column->iterator(irs::ColumnHint::kNormal); ASSERT_NE(nullptr, values); auto* actual_value = irs::get(*values); @@ -985,7 +986,7 @@ TEST_P(bm25_test_case, test_query) { filter.mutable_options()->range.max = irs::ViewCast(std::string_view("9")); filter.mutable_options()->range.max_type = irs::BoundType::EXCLUSIVE; - filter.mutable_options()->scored_terms_limit = 1; + filter.mutable_options()->scored_terms_limit = limit; std::multimap> sorted; constexpr std::array expected{3, 7}; @@ -1023,49 +1024,6 @@ TEST_P(bm25_test_case, test_query) { EXPECT_GT(counter.max, 0); counter.Reset(); - // FIXME!!! - // // by_range single + scored_terms_limit(0) - // { - // auto values = column->iterator(irs::ColumnHint::kNormal); - // ASSERT_NE(nullptr, values); - // auto* actual_value = irs::get(*values); - // ASSERT_NE(nullptr, actual_value); - // - // irs::by_range filter; - // - // filter.field("field").scored_terms_limit(0) - // .include(true).term("8") - // .include(false).term("9"); - // - // std::multimap> sorted; - // constexpr std::array expected{ 3, 7 }; - // - // irs::bytes_view_input in; - // auto prepared_filter = filter.prepare({.index=reader, - // .scorers=prepared_order}); auto docs = - // prepared_filter->execute({.segment=segment, .scorers=prepared_order}); - // auto* score = irs::get(*docs); - // ASSERT_TRUE(bool(score)); - // - // while(docs->next()) { - // irs::score_t score_value; - // (*score)(&score_value); - // ASSERT_EQ(docs->value(), values->seek(docs->value())); - // in.reset(actual_value->value); - // - // auto str_seq = irs::read_string(in); - // auto seq = strtoull(str_seq.c_str(), nullptr, 10); - // sorted.emplace(score_value, seq); - // } - // - // ASSERT_EQ(expected.size(), sorted.size()); - // size_t i = 0; - // - // for (auto& entry: sorted) { - // ASSERT_EQ(expected[i++], entry.second); - // } - // } - // by_range multiple { auto values = column->iterator(irs::ColumnHint::kNormal); diff --git a/tests/search/tfidf_test.cpp b/tests/search/tfidf_test.cpp index 962e4ef27..6a6056afc 100644 --- a/tests/search/tfidf_test.cpp +++ b/tests/search/tfidf_test.cpp @@ -970,8 +970,9 @@ TEST_P(tfidf_test_case, test_query) { EXPECT_GT(counter.max, 0); counter.Reset(); + // by_range single + scored_terms_limit(0) // by_range single + scored_terms_limit(1) - { + for (size_t limit = 0; limit != 2; ++limit) { auto values = column->iterator(irs::ColumnHint::kNormal); ASSERT_NE(nullptr, values); auto* actual_value = irs::get(*values); @@ -985,7 +986,7 @@ TEST_P(tfidf_test_case, test_query) { filter.mutable_options()->range.max = irs::ViewCast(std::string_view("9")); filter.mutable_options()->range.max_type = irs::BoundType::EXCLUSIVE; - filter.mutable_options()->scored_terms_limit = 1; + filter.mutable_options()->scored_terms_limit = limit; std::multimap> sorted; std::vector expected{3, 7}; @@ -1022,49 +1023,6 @@ TEST_P(tfidf_test_case, test_query) { EXPECT_GT(counter.max, 0); counter.Reset(); - // FIXME!!! - // by_range single + scored_terms_limit(0) - // { - // auto values = column->iterator(irs::ColumnHint::kNormal); - // ASSERT_NE(nullptr, values); - // auto* actual_value = irs::get(*values); - // ASSERT_NE(nullptr, actual_value); - // - // irs::by_range filter; - // - // filter.field("field").scored_terms_limit(0) - // .include(true).term("8") - // .include(false).term("9"); - // - // std::multimap> sorted; - // std::vector expected{ 3, 7 }; - // - // irs::bytes_view_input in; - // auto prepared_filter = filter.prepare({.index=reader, - // .scorers=prepared_order}); auto docs = - // prepared_filter->execute({.segment=segment, .scorers=prepared_order}); - // auto* score = irs::get(*docs); - // ASSERT_TRUE(bool(score)); - // - // while(docs->next()) { - // irs::score_t score_value; - // (*score)(&score_value); - // ASSERT_EQ(docs->value(), values->seek(docs->value())); - // in.reset(actual_value->value); - // - // auto str_seq = irs::read_string(in); - // auto seq = strtoull(str_seq.c_str(), nullptr, 10); - // sorted.emplace(score_value, seq); - // } - // - // ASSERT_EQ(expected.size(), sorted.size()); - // size_t i = 0; - // - // for (auto& entry: sorted) { - // ASSERT_EQ(expected[i++], entry.second); - // } - // } - // by_range multiple { auto values = column->iterator(irs::ColumnHint::kNormal);