summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-12-05 12:41:49 +0100
committerGitHub <noreply@github.com>2023-12-05 12:41:49 +0100
commit77f281bef1c7bc7cc5153e3b6085d752fbac11ad (patch)
tree73d287551de63491b825bef7d8c772973034e53b /searchlib
parent022448ee7265264b12f418381cca099d5eefb34d (diff)
parent042e1e33a2e1c5dd92d1a3febdcd3c7de50e390c (diff)
Merge pull request #29548 from vespa-engine/balder/control-create-postinglist-when-non-strict
Balder/control create postinglist when non strict
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h2
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.h10
-rw-r--r--searchlib/src/vespa/searchlib/fef/ranksetup.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/fef/ranksetup.h2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/blueprint.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/executeinfo.h19
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp2
9 files changed, 40 insertions, 9 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
index f5683546eea..eefb2ea77d5 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
@@ -436,6 +436,8 @@ NumericPostingSearchContext<BaseSC, AttrT, DataT>::use_posting_lists_when_non_st
// Based on this we see that LMC = 5 * PLMC.
// The same relationship is found with the test case range_hits_ratio=[200].
+ if ( ! info.create_postinglist_when_non_strict()) return false;
+
constexpr float lookup_match_constant = 5.0;
constexpr float posting_list_merge_constant = 1.0;
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
index 9c986d0bc63..d503a955afc 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
@@ -461,6 +461,12 @@ bool AlwaysMarkPhraseExpensive::check(const Properties &props, bool fallback) {
return lookupBool(props, NAME, fallback);
}
+const vespalib::string CreatePostingListWhenNonStrict::NAME("vespa.matching.create_postinglist_when_non_strict");
+const bool CreatePostingListWhenNonStrict::DEFAULT_VALUE(true);
+bool CreatePostingListWhenNonStrict::check(const Properties &props, bool fallback) {
+ return lookupBool(props, NAME, fallback);
+}
+
} // namespace matching
namespace softtimeout {
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.h b/searchlib/src/vespa/searchlib/fef/indexproperties.h
index 1921f52276f..7262e599235 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.h
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.h
@@ -347,6 +347,16 @@ namespace matching {
static bool check(const Properties &props) { return check(props, DEFAULT_VALUE); }
static bool check(const Properties &props, bool fallback);
};
+
+ /**
+ * When enabled posting lists can be created on the fly even if iterator is not strict.
+ **/
+ struct CreatePostingListWhenNonStrict {
+ static const vespalib::string NAME;
+ static const bool DEFAULT_VALUE;
+ static bool check(const Properties &props) { return check(props, DEFAULT_VALUE); }
+ static bool check(const Properties &props, bool fallback);
+ };
}
namespace softtimeout {
diff --git a/searchlib/src/vespa/searchlib/fef/ranksetup.cpp b/searchlib/src/vespa/searchlib/fef/ranksetup.cpp
index d6b0b900516..ed74386b2fa 100644
--- a/searchlib/src/vespa/searchlib/fef/ranksetup.cpp
+++ b/searchlib/src/vespa/searchlib/fef/ranksetup.cpp
@@ -61,6 +61,7 @@ RankSetup::RankSetup(const BlueprintFactory &factory, const IIndexEnvironment &i
_compileError(false),
_degradationAscendingOrder(false),
_always_mark_phrase_expensive(false),
+ _create_postinglist_when_non_strict(true),
_diversityAttribute(),
_diversityMinGroups(1),
_diversityCutoffFactor(10.0),
@@ -135,6 +136,7 @@ RankSetup::configure()
_mutateOnSummary._operation = mutate::on_summary::Operation::lookup(_indexEnv.getProperties());
_mutateAllowQueryOverride = mutate::AllowQueryOverride::check(_indexEnv.getProperties());
_always_mark_phrase_expensive = matching::AlwaysMarkPhraseExpensive::check(_indexEnv.getProperties());
+ _create_postinglist_when_non_strict = matching::CreatePostingListWhenNonStrict::check(_indexEnv.getProperties());
}
void
diff --git a/searchlib/src/vespa/searchlib/fef/ranksetup.h b/searchlib/src/vespa/searchlib/fef/ranksetup.h
index d744b38cc6e..d560614ce39 100644
--- a/searchlib/src/vespa/searchlib/fef/ranksetup.h
+++ b/searchlib/src/vespa/searchlib/fef/ranksetup.h
@@ -70,6 +70,7 @@ private:
bool _compileError;
bool _degradationAscendingOrder;
bool _always_mark_phrase_expensive;
+ bool _create_postinglist_when_non_strict;
vespalib::string _diversityAttribute;
uint32_t _diversityMinGroups;
double _diversityCutoffFactor;
@@ -222,6 +223,7 @@ public:
return _degradationAscendingOrder;
}
bool always_mark_phrase_expensive() const noexcept { return _always_mark_phrase_expensive; }
+ bool create_postinglist_when_non_strict() const noexcept { return _create_postinglist_when_non_strict; }
/** get number of hits to collect during graceful degradation in match phase */
uint32_t getDegradationMaxHits() const {
return _degradationMaxHits;
diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
index 639805e116e..6bc125226de 100644
--- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
@@ -624,7 +624,7 @@ IntermediateBlueprint::fetchPostings(const ExecuteInfo &execInfo)
double nextHitRate = execInfo.hitRate();
for (size_t i = 0; i < _children.size(); ++i) {
Blueprint & child = *_children[i];
- child.fetchPostings(ExecuteInfo::create(execInfo.isStrict() && inheritStrict(i), nextHitRate, execInfo.getDoom()));
+ child.fetchPostings(ExecuteInfo::create(execInfo.isStrict() && inheritStrict(i), nextHitRate, execInfo));
nextHitRate = computeNextHitRate(child, nextHitRate);
}
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp b/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp
index 6a7ca84b72f..27366a9b924 100644
--- a/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp
@@ -4,7 +4,7 @@
namespace search::queryeval {
-const ExecuteInfo ExecuteInfo::TRUE(true, 1.0, nullptr);
-const ExecuteInfo ExecuteInfo::FALSE(false, 1.0, nullptr);
+const ExecuteInfo ExecuteInfo::TRUE(true, 1.0, nullptr, true);
+const ExecuteInfo ExecuteInfo::FALSE(false, 1.0, nullptr, true);
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/executeinfo.h b/searchlib/src/vespa/searchlib/queryeval/executeinfo.h
index 362b0826f67..0095429e609 100644
--- a/searchlib/src/vespa/searchlib/queryeval/executeinfo.h
+++ b/searchlib/src/vespa/searchlib/queryeval/executeinfo.h
@@ -12,18 +12,25 @@ namespace search::queryeval {
*/
class ExecuteInfo {
public:
- ExecuteInfo() noexcept : ExecuteInfo(false, 1.0F, nullptr) { }
+ ExecuteInfo() noexcept : ExecuteInfo(false, 1.0F, nullptr, true) { }
bool isStrict() const noexcept { return _strict; }
+ bool create_postinglist_when_non_strict() const noexcept { return _create_postinglist_when_non_strict; }
float hitRate() const noexcept { return _hitRate; }
bool soft_doom() const noexcept { return _doom && _doom->soft_doom(); }
const vespalib::Doom * getDoom() const { return _doom; }
static const ExecuteInfo TRUE;
static const ExecuteInfo FALSE;
static ExecuteInfo create(bool strict, const ExecuteInfo & org) noexcept {
- return {strict, org._hitRate, org.getDoom()};
+ return {strict, org._hitRate, org.getDoom(), org.create_postinglist_when_non_strict()};
+ }
+ static ExecuteInfo create(bool strict, float hitRate, const ExecuteInfo & org) noexcept {
+ return {strict, hitRate, org.getDoom(), org.create_postinglist_when_non_strict()};
}
static ExecuteInfo create(bool strict, float hitRate, const vespalib::Doom * doom) noexcept {
- return {strict, hitRate, doom};
+ return create(strict, hitRate, doom, true);
+ }
+ static ExecuteInfo create(bool strict, float hitRate, const vespalib::Doom * doom, bool postinglist_when_non_strict) noexcept {
+ return {strict, hitRate, doom, postinglist_when_non_strict};
}
static ExecuteInfo createForTest(bool strict) noexcept {
return createForTest(strict, 1.0F);
@@ -32,14 +39,16 @@ public:
return create(strict, hitRate, nullptr);
}
private:
- ExecuteInfo(bool strict, float hitRate_in, const vespalib::Doom * doom) noexcept
+ ExecuteInfo(bool strict, float hitRate_in, const vespalib::Doom * doom, bool postinglist_when_non_strict) noexcept
: _doom(doom),
_hitRate(hitRate_in),
- _strict(strict)
+ _strict(strict),
+ _create_postinglist_when_non_strict(postinglist_when_non_strict)
{ }
const vespalib::Doom * _doom;
float _hitRate;
bool _strict;
+ bool _create_postinglist_when_non_strict;
};
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp
index 5c795679d48..c93cef47c27 100644
--- a/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.cpp
@@ -63,7 +63,7 @@ SameElementBlueprint::fetchPostings(const ExecuteInfo &execInfo)
double hit_rate = execInfo.hitRate() * _terms[0]->hit_ratio();
for (size_t i = 1; i < _terms.size(); ++i) {
Blueprint & term = *_terms[i];
- term.fetchPostings(ExecuteInfo::create(false, hit_rate, execInfo.getDoom()));
+ term.fetchPostings(ExecuteInfo::create(false, hit_rate, execInfo));
hit_rate = hit_rate * term.hit_ratio();
}
}