diff options
author | Haavard <havardpe@yahoo-inc.com> | 2017-02-24 12:49:34 +0000 |
---|---|---|
committer | Haavard <havardpe@yahoo-inc.com> | 2017-02-24 12:49:34 +0000 |
commit | 93110996e8384cb4e191084583c7c068fd91a566 (patch) | |
tree | 40cb80e4dfdb6520e235b1d9396b0d805d14af11 /searchlib/src | |
parent | d16bd3f25eed06dc7449f5f2b7809ee97280e4ad (diff) |
add flag to enable lazy expressions
Diffstat (limited to 'searchlib/src')
-rw-r--r-- | searchlib/src/tests/fef/properties/properties_test.cpp | 8 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/fef/indexproperties.cpp | 13 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/fef/indexproperties.h | 11 |
3 files changed, 32 insertions, 0 deletions
diff --git a/searchlib/src/tests/fef/properties/properties_test.cpp b/searchlib/src/tests/fef/properties/properties_test.cpp index 7ca79599d5c..7f5594ea821 100644 --- a/searchlib/src/tests/fef/properties/properties_test.cpp +++ b/searchlib/src/tests/fef/properties/properties_test.cpp @@ -215,6 +215,14 @@ TEST("test stuff") { } { // test index properties known by the framework + { // vespa.eval.lazy_expressions + EXPECT_EQUAL(eval::LazyExpressions::NAME, vespalib::string("vespa.eval.lazy_expressions")); + EXPECT_EQUAL(eval::LazyExpressions::DEFAULT_VALUE, vespalib::string("false")); + Properties p; + EXPECT_TRUE(!eval::LazyExpressions::check(p)); + p.add("vespa.eval.lazy_expressions", "true"); + EXPECT_TRUE(eval::LazyExpressions::check(p)); + } { // vespa.rank.firstphase EXPECT_EQUAL(rank::FirstPhase::NAME, vespalib::string("vespa.rank.firstphase")); EXPECT_EQUAL(rank::FirstPhase::DEFAULT_VALUE, vespalib::string("nativeRank")); diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp index 23874924ddb..b75a0f33393 100644 --- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp +++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp @@ -74,6 +74,19 @@ checkIfTrue(const Properties &props, const vespalib::string &name, } +namespace eval { + +const vespalib::string LazyExpressions::NAME("vespa.eval.lazy_expressions"); +const vespalib::string LazyExpressions::DEFAULT_VALUE("false"); + +bool +LazyExpressions::check(const Properties &props) +{ + return checkIfTrue(props, NAME, DEFAULT_VALUE); +} + +} // namespace eval + namespace rank { const vespalib::string FirstPhase::NAME("vespa.rank.firstphase"); diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.h b/searchlib/src/vespa/searchlib/fef/indexproperties.h index 2a37f2f93fd..4a97535879b 100644 --- a/searchlib/src/vespa/searchlib/fef/indexproperties.h +++ b/searchlib/src/vespa/searchlib/fef/indexproperties.h @@ -21,6 +21,17 @@ class Properties; **/ namespace indexproperties { +namespace eval { + +// lazy evaluation of expressions. affects rank/summary/dump +struct LazyExpressions { + static const vespalib::string NAME; + static const vespalib::string DEFAULT_VALUE; + static bool check(const Properties &props); +}; + +} // namespace eval + namespace rank { /** |