From 4f5be349db2d4bef3f53be62fd7cbee9f8a8b9cd Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 1 Jan 2020 21:41:30 +0000 Subject: Consider estimated hitrate. --- .../imported_search_context_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'searchlib/src/tests/attribute/imported_search_context') diff --git a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp index 1db013aaef3..53ad14f3c28 100644 --- a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp +++ b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp @@ -218,6 +218,24 @@ TEST_F("Strict iterator is marked as strict", Fixture) { EXPECT_TRUE(iter->is_strict() == Trinary::True); // No EXPECT_EQUALS printing of Trinary... } +TEST_F("Non-strict blueprint with high hit rate is strict", Fixture) { + auto ctx = f.create_context(word_term("5678")); + ctx->fetchPostings(queryeval::ExecuteInfo::create(false, 0.02)); + TermFieldMatchData match; + auto iter = f.create_iterator(*ctx, match, false); + + EXPECT_TRUE(iter->is_strict() == Trinary::True); +} + +TEST_F("Non-strict blueprint with low hit rate is non-strict", Fixture) { + auto ctx = f.create_context(word_term("5678")); + ctx->fetchPostings(queryeval::ExecuteInfo::create(false, 0.01)); + TermFieldMatchData match; + auto iter = f.create_iterator(*ctx, match, false); + + EXPECT_TRUE(iter->is_strict() == Trinary::False); +} + struct SingleValueFixture : Fixture { SingleValueFixture() { reset_with_single_value_reference_mappings( -- cgit v1.2.3