Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Enable tests (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
MBkkt authored Mar 20, 2024
1 parent 932b08b commit 0149778
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 90 deletions.
48 changes: 3 additions & 45 deletions tests/search/bm25_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<irs::payload>(*values);
Expand All @@ -985,7 +986,7 @@ TEST_P(bm25_test_case, test_query) {
filter.mutable_options()->range.max =
irs::ViewCast<irs::byte_type>(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<irs::score_t, uint32_t, std::greater<>> sorted;
constexpr std::array expected{3, 7};
Expand Down Expand Up @@ -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<irs::payload>(*values);
// ASSERT_NE(nullptr, actual_value);
//
// irs::by_range filter;
//
// filter.field("field").scored_terms_limit(0)
// .include<irs::Bound::MIN>(true).term<irs::Bound::MIN>("8")
// .include<irs::Bound::MAX>(false).term<irs::Bound::MAX>("9");
//
// std::multimap<irs::score_t, uint32_t, std::greater<>> 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<irs::score>(*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<std::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);
Expand Down
48 changes: 3 additions & 45 deletions tests/search/tfidf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<irs::payload>(*values);
Expand All @@ -985,7 +986,7 @@ TEST_P(tfidf_test_case, test_query) {
filter.mutable_options()->range.max =
irs::ViewCast<irs::byte_type>(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<irs::score_t, uint64_t, std::greater<>> sorted;
std::vector<uint64_t> expected{3, 7};
Expand Down Expand Up @@ -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<irs::payload>(*values);
// ASSERT_NE(nullptr, actual_value);
//
// irs::by_range filter;
//
// filter.field("field").scored_terms_limit(0)
// .include<irs::Bound::MIN>(true).term<irs::Bound::MIN>("8")
// .include<irs::Bound::MAX>(false).term<irs::Bound::MAX>("9");
//
// std::multimap<irs::score_t, uint64_t, std::greater<>> sorted;
// std::vector<uint64_t> 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<irs::score>(*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<std::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);
Expand Down

0 comments on commit 0149778

Please sign in to comment.