aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/queryeval/blueprint
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-12-09 23:01:08 +0100
committerGitHub <noreply@github.com>2023-12-09 23:01:08 +0100
commita61f656529cca2ce016fdbfb2ca53b7a487d73a7 (patch)
tree265fb65dd66fcbafb61a1bcb298e73368461ec75 /searchlib/src/tests/queryeval/blueprint
parentedcdc7775e0a268a6af446351c7e0f09bd8d13de (diff)
Revert "relative estimate"
Diffstat (limited to 'searchlib/src/tests/queryeval/blueprint')
-rw-r--r--searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp9
-rw-r--r--searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp56
2 files changed, 6 insertions, 59 deletions
diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp
index 2d621fa1011..372b76fa9af 100644
--- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp
+++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp
@@ -22,7 +22,6 @@ class MyOr : public IntermediateBlueprint
{
private:
public:
- double calculate_relative_estimate() const final { return 0.5; }
HitEstimate combine(const std::vector<HitEstimate> &data) const override {
return max(data);
}
@@ -640,7 +639,6 @@ getExpectedBlueprint()
" estimate: HitEstimate {\n"
" empty: false\n"
" estHits: 9\n"
- " relative_estimate: 0.5\n"
" cost_tier: 1\n"
" tree_size: 2\n"
" allow_termwise_eval: false\n"
@@ -660,7 +658,6 @@ getExpectedBlueprint()
" estimate: HitEstimate {\n"
" empty: false\n"
" estHits: 9\n"
- " relative_estimate: 0.5\n"
" cost_tier: 1\n"
" tree_size: 1\n"
" allow_termwise_eval: true\n"
@@ -690,7 +687,6 @@ getExpectedSlimeBlueprint() {
" '[type]': 'HitEstimate',"
" empty: false,"
" estHits: 9,"
- " relative_estimate: 0.5,"
" cost_tier: 1,"
" tree_size: 2,"
" allow_termwise_eval: false"
@@ -715,7 +711,6 @@ getExpectedSlimeBlueprint() {
" '[type]': 'HitEstimate',"
" empty: false,"
" estHits: 9,"
- " relative_estimate: 0.5,"
" cost_tier: 1,"
" tree_size: 1,"
" allow_termwise_eval: true"
@@ -772,9 +767,9 @@ TEST("requireThatDocIdLimitInjectionWorks")
}
TEST("Control object sizes") {
- EXPECT_EQUAL(40u, sizeof(Blueprint::State));
+ EXPECT_EQUAL(32u, sizeof(Blueprint::State));
EXPECT_EQUAL(32u, sizeof(Blueprint));
- EXPECT_EQUAL(72u, sizeof(LeafBlueprint));
+ EXPECT_EQUAL(64u, sizeof(LeafBlueprint));
}
TEST_MAIN() {
diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
index 5078672e84e..38e7e27163d 100644
--- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
+++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
@@ -157,9 +157,9 @@ TEST("test Or propagates updated histestimate") {
EXPECT_TRUE(child.executeInfo.isStrict());
}
EXPECT_EQUAL(1.0f, dynamic_cast<const RememberExecuteInfo &>(bp->getChild(0)).executeInfo.hitRate());
- EXPECT_APPROX(0.5f, dynamic_cast<const RememberExecuteInfo &>(bp->getChild(1)).executeInfo.hitRate(), 1e-6);
- EXPECT_APPROX(0.5*3.0f/5.0f, dynamic_cast<const RememberExecuteInfo &>(bp->getChild(2)).executeInfo.hitRate(), 1e-6);
- EXPECT_APPROX(0.5*3.0f*42.0f/(5.0f*50.0f), dynamic_cast<const RememberExecuteInfo &>(bp->getChild(3)).executeInfo.hitRate(), 1e-6);
+ EXPECT_EQUAL(1.0f, dynamic_cast<const RememberExecuteInfo &>(bp->getChild(1)).executeInfo.hitRate());
+ EXPECT_EQUAL(3.0f/5.0f, dynamic_cast<const RememberExecuteInfo &>(bp->getChild(2)).executeInfo.hitRate());
+ EXPECT_EQUAL(3.0f*42.0f/(5.0f*50.0f), dynamic_cast<const RememberExecuteInfo &>(bp->getChild(3)).executeInfo.hitRate());
}
TEST("test And Blueprint") {
@@ -644,11 +644,7 @@ struct make {
child->setSourceId(source_tag);
source_tag = invalid_source;
}
- if (auto *weak_and = making->asWeakAnd()) {
- weak_and->addTerm(std::move(child), 1);
- } else {
- making->addChild(std::move(child));
- }
+ making->addChild(std::move(child));
return std::move(*this);
}
make &&leaf(uint32_t estimate) && {
@@ -665,9 +661,6 @@ struct make {
static make RANK() { return make(std::make_unique<RankBlueprint>()); }
static make ANDNOT() { return make(std::make_unique<AndNotBlueprint>()); }
static make SB(ISourceSelector &selector) { return make(std::make_unique<SourceBlenderBlueprint>(selector)); }
- static make NEAR(uint32_t window) { return make(std::make_unique<NearBlueprint>(window)); }
- static make ONEAR(uint32_t window) { return make(std::make_unique<ONearBlueprint>(window)); }
- static make WEAKAND(uint32_t n) { return make(std::make_unique<WeakAndBlueprint>(n)); }
};
TEST("AND AND collapsing") {
@@ -1188,45 +1181,4 @@ TEST("require that OR blueprint use saturated sum as estimate") {
TEST_DO(verify_or_est({{100, false},{300, false},{200, false}}, {300, false}));
}
-void verify_relative_estimate(make &&mk, double expect) {
- EXPECT_EQUAL(mk.making->estimate(), 0.0);
- Blueprint::UP bp = std::move(mk).leafs({200,300,950});
- bp->setDocIdLimit(1000);
- EXPECT_EQUAL(bp->estimate(), expect);
-}
-
-TEST("relative estimate for OR") {
- verify_relative_estimate(make::OR(), 1.0-0.8*0.7*0.5);
-}
-
-TEST("relative estimate for AND") {
- verify_relative_estimate(make::AND(), 0.2*0.3*0.5);
-}
-
-TEST("relative estimate for RANK") {
- verify_relative_estimate(make::RANK(), 0.2);
-}
-
-TEST("relative estimate for ANDNOT") {
- verify_relative_estimate(make::ANDNOT(), 0.2);
-}
-
-TEST("relative estimate for SB") {
- InvalidSelector sel;
- verify_relative_estimate(make::SB(sel), 1.0-0.8*0.7*0.5);
-}
-
-TEST("relative estimate for NEAR") {
- verify_relative_estimate(make::NEAR(1), 0.2*0.3*0.5);
-}
-
-TEST("relative estimate for ONEAR") {
- verify_relative_estimate(make::ONEAR(1), 0.2*0.3*0.5);
-}
-
-TEST("relative estimate for WEAKAND") {
- verify_relative_estimate(make::WEAKAND(1000), 1.0-0.8*0.7*0.5);
- verify_relative_estimate(make::WEAKAND(50), 0.05);
-}
-
TEST_MAIN() { TEST_DEBUG("lhs.out", "rhs.out"); TEST_RUN_ALL(); }