aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-01-23 10:51:55 +0100
committerGitHub <noreply@github.com>2024-01-23 10:51:55 +0100
commitbbdde86571e6a4449925841960190f2b292b9f9a (patch)
treed2e6ad7f6fa8932bdcc4cd10cc8ce466ed674e4c /searchcore
parentbe650737422784d4562f729ac198a7a0265e7af9 (diff)
parent56da1f042e9d2d545267c33242a51bf94a5fd12b (diff)
Merge pull request #30017 from vespa-engine/havardpe/wire-flow-cost
wire in strict flow analysis and strict-aware sorting
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.cpp5
2 files changed, 6 insertions, 6 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp
index e136e491f05..4aefa10f5f2 100644
--- a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp
@@ -180,9 +180,10 @@ TEST_F(LidAllocatorTest, whitelist_blueprint_can_maximize_relative_estimate)
activate_lids({ 1, 2, 3, 4 }, true);
// the number of hits are overestimated based on the number of
// documents that could be active (100 in this test fixture)
- EXPECT_EQ(make_whitelist_blueprint(1000)->estimate(), 0.1);
- EXPECT_EQ(make_whitelist_blueprint(200)->estimate(), 0.5);
- EXPECT_EQ(make_whitelist_blueprint(5)->estimate(), 1.0);
+ // NOTE: optimize must be called in order to calculate the relative estimate
+ EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(1000))->estimate(), 0.1);
+ EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(200))->estimate(), 0.5);
+ EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(5))->estimate(), 1.0);
}
class LidAllocatorPerformanceTest : public LidAllocatorTest,
diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
index a93e8fbbddc..5ade0a44b8a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
@@ -200,8 +200,7 @@ Query::reserveHandles(const IRequestContext & requestContext, ISearchContext &co
void
Query::optimize(bool sort_by_cost)
{
- (void) sort_by_cost;
- _blueprint = Blueprint::optimize(std::move(_blueprint), sort_by_cost);
+ _blueprint = Blueprint::optimize_and_sort(std::move(_blueprint), true, sort_by_cost);
LOG(debug, "optimized blueprint:\n%s\n", _blueprint->asString().c_str());
}
@@ -223,7 +222,7 @@ Query::handle_global_filter(const IRequestContext & requestContext, uint32_t doc
}
// optimized order may change after accounting for global filter:
trace.addEvent(5, "Optimize query execution plan to account for global filter");
- _blueprint = Blueprint::optimize(std::move(_blueprint), sort_by_cost);
+ _blueprint = Blueprint::optimize_and_sort(std::move(_blueprint), true, sort_by_cost);
LOG(debug, "blueprint after handle_global_filter:\n%s\n", _blueprint->asString().c_str());
// strictness may change if optimized order changed:
fetchPostings(ExecuteInfo::create(true, 1.0, requestContext.getDoom(), requestContext.thread_bundle()));