summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-12-24 11:09:34 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-12-31 15:58:39 +0000
commit7d7b46f012b4f9bbd416f17a945204acc28c6ae5 (patch)
tree96a4cc5f82fea12b073e70522219c5c6b36ffbec /searchcore
parent6d7909e022817be11b5f088cbd1e537d9b71919d (diff)
Add ExecutionInfo to propagate more information than just strictness to fetchPostings.
The estimated hitrate that each iterator will will enable smarter query evaluation. Especially will it be possible to figure out if static up front cost can be avoided.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp2
-rw-r--r--searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp2
-rw-r--r--searchcore/src/tests/proton/index/fusionrunner_test.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp9
-rw-r--r--searchcore/src/tests/proton/matching/query_test.cpp11
-rw-r--r--searchcore/src/tests/proton/matching/querynodes_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.cpp2
9 files changed, 19 insertions, 16 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
index 4dbc6be57ff..f8069dcf494 100644
--- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
@@ -193,7 +193,7 @@ assertWhiteList(const SimpleResult &exp, Blueprint::UP whiteListBlueprint, bool
{
MatchDataLayout mdl;
MatchData::UP md = mdl.createMatchData();
- whiteListBlueprint->fetchPostings(strict);
+ whiteListBlueprint->fetchPostings(search::queryeval::ExecuteInfo::create(strict));
whiteListBlueprint->setDocIdLimit(docIdLimit);
SearchIterator::UP sb = whiteListBlueprint->createSearch(*md, strict);
diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp
index 4580865b3a4..ca45108b698 100644
--- a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp
+++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp
@@ -125,7 +125,7 @@ void Test::testSearch(Searchable &source,
SimpleStringTerm node(term, field_name, 0, search::query::Weight(0));
Blueprint::UP result = source.createBlueprint(requestContext,
FieldSpecList().add(FieldSpec(field_name, 0, handle)), node);
- result->fetchPostings(true);
+ result->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
SearchIterator::UP search_iterator =
result->createSearch(*match_data, true);
search_iterator->initFullRange();
diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp
index 49b452aec2e..975061f9d88 100644
--- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp
+++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp
@@ -243,7 +243,7 @@ void Test::checkResults(uint32_t fusion_id, const uint32_t *ids, size_t size) {
search::queryeval::Searchable &searchable = disk_index;
SimpleStringTerm node(term, field_name, fieldId, search::query::Weight(0));
Blueprint::UP blueprint = searchable.createBlueprint(requestContext, fields, node);
- blueprint->fetchPostings(true);
+ blueprint->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
SearchIterator::UP search = blueprint->createSearch(*match_data, true);
search->initFullRange();
for (size_t i = 0; i < size; ++i) {
diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
index 2d0482b0d92..201824cd764 100644
--- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
+++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
@@ -4,6 +4,7 @@
#include <vespa/searchlib/queryeval/termasstring.h>
#include <vespa/searchlib/queryeval/andsearchstrict.h>
#include <vespa/searchlib/queryeval/fake_requestcontext.h>
+#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <vespa/searchlib/engine/trace.h>
#include <vespa/vespalib/data/slime/slime.h>
@@ -54,7 +55,7 @@ struct MockBlueprint : SimpleLeafBlueprint {
FieldSpec spec;
vespalib::string term;
bool postings_fetched = false;
- bool postings_strict = false;
+ search::queryeval::ExecuteInfo postings_strict = search::queryeval::ExecuteInfo::FALSE;
MockBlueprint(const FieldSpec &spec_in, const vespalib::string &term_in)
: SimpleLeafBlueprint(FieldSpecBaseList().add(spec_in)), spec(spec_in), term(term_in)
{
@@ -64,13 +65,13 @@ struct MockBlueprint : SimpleLeafBlueprint {
bool strict) const override
{
if (postings_fetched) {
- EXPECT_EQUAL(postings_strict, strict);
+ EXPECT_EQUAL(postings_strict.isStrict(), strict);
}
return SearchIterator::UP(new MockSearch(spec, term, strict, tfmda,
postings_fetched));
}
- virtual void fetchPostings(bool strict) override {
- postings_strict = strict;
+ virtual void fetchPostings(const search::queryeval::ExecuteInfo &execInfo) override {
+ postings_strict = execInfo;
postings_fetched = true;
}
};
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp
index cc6d964219d..a1215649943 100644
--- a/searchcore/src/tests/proton/matching/query_test.cpp
+++ b/searchcore/src/tests/proton/matching/query_test.cpp
@@ -69,6 +69,7 @@ using search::queryeval::AndBlueprint;
using search::queryeval::IntermediateBlueprint;
using search::queryeval::AndNotBlueprint;
using search::queryeval::SourceBlenderBlueprint;
+using search::queryeval::ExecuteInfo;
using std::string;
using std::vector;
@@ -455,7 +456,7 @@ SearchIterator::UP Test::getIterator(Node &node, ISearchContext &context) {
_blueprint = BlueprintBuilder::build(_requestContext, node, context);
- _blueprint->fetchPostings(true);
+ _blueprint->fetchPostings(ExecuteInfo::TRUE);
SearchIterator::UP search(_blueprint->createSearch(*_match_data, true));
search->initFullRange();
return search;
@@ -822,10 +823,10 @@ Test::requireThatFakeFieldSearchDumpsDiffer()
Blueprint::UP l3(a.createBlueprint(requestContext, fields2, n3)); // field
Blueprint::UP l4(b.createBlueprint(requestContext, fields1, n1)); // tag
- l1->fetchPostings(true);
- l2->fetchPostings(true);
- l3->fetchPostings(true);
- l4->fetchPostings(true);
+ l1->fetchPostings(ExecuteInfo::TRUE);
+ l2->fetchPostings(ExecuteInfo::TRUE);
+ l3->fetchPostings(ExecuteInfo::TRUE);
+ l4->fetchPostings(ExecuteInfo::TRUE);
SearchIterator::UP s1(l1->createSearch(*match_data, true));
SearchIterator::UP s2(l2->createSearch(*match_data, true));
diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp
index 297f75054b2..5d01753dfb6 100644
--- a/searchcore/src/tests/proton/matching/querynodes_test.cpp
+++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp
@@ -201,7 +201,7 @@ public:
MatchData::UP match_data = mdl.createMatchData();
Blueprint::UP blueprint = BlueprintBuilder::build(requestContext, node, context);
- blueprint->fetchPostings(true);
+ blueprint->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
return blueprint->createSearch(*match_data, true)->asString();
}
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
index 94217371af3..0c03727e017 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
@@ -2,6 +2,7 @@
#include "lid_allocator.h"
#include <vespa/searchlib/common/bitvectoriterator.h>
+#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <mutex>
#include <vespa/log/log.h>
@@ -197,7 +198,7 @@ private:
mutable std::mutex _lock;
mutable std::vector<search::fef::TermFieldMatchData *> _matchDataVector;
- virtual SearchIterator::UP
+ SearchIterator::UP
createLeafSearch(const TermFieldMatchDataArray &tfmda,
bool strict) const override
{
diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
index d165a18ae37..a0841295746 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
@@ -77,7 +77,7 @@ AttributeLimiter::create_search(size_t want_hits, size_t max_group_size, bool st
FieldSpecList field; // single field API is protected
field.add(FieldSpec(_attribute_name, my_field_id, my_handle));
_blueprint = _searchable_attributes.createBlueprint(_requestContext, field, node);
- _blueprint->fetchPostings(strictSearch);
+ _blueprint->fetchPostings(ExecuteInfo::create(strictSearch));
_estimatedHits = _blueprint->getState().estimate().estHits;
_blueprint->freeze();
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
index fb9882bf1b1..04fdf57769a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp
@@ -195,7 +195,7 @@ Query::optimize()
void
Query::fetchPostings()
{
- _blueprint->fetchPostings(true);
+ _blueprint->fetchPostings(search::queryeval::ExecuteInfo(true, 1.0));
}
void