summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-03-29 22:25:27 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-03-29 22:25:27 +0000
commit93ba5f84db88cf73f3996b52a616cdb14804e254 (patch)
treeec95568c1d93daf533c5c357b0bf09009c6e5b51
parent3169f66bf208aa984605fa319046aabccc61c421 (diff)
Add missing move operators that avoid alot of copying when dealing with vectors and maps.
-rw-r--r--searchlib/src/tests/fef/properties/properties_test.cpp26
-rw-r--r--searchlib/src/tests/nativerank/nativerank.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/engine/docsumrequest.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/engine/docsumrequest.h5
-rw-r--r--searchlib/src/vespa/searchlib/engine/propertiesmap.h2
-rw-r--r--searchlib/src/vespa/searchlib/fef/properties.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/fef/properties.h4
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp13
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp25
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h16
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp7
11 files changed, 48 insertions, 63 deletions
diff --git a/searchlib/src/tests/fef/properties/properties_test.cpp b/searchlib/src/tests/fef/properties/properties_test.cpp
index b7478da3f71..7b919e4aaa6 100644
--- a/searchlib/src/tests/fef/properties/properties_test.cpp
+++ b/searchlib/src/tests/fef/properties/properties_test.cpp
@@ -216,15 +216,23 @@ 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"));
- Properties p;
- EXPECT_TRUE(eval::LazyExpressions::check(p, true));
- EXPECT_TRUE(!eval::LazyExpressions::check(p, false));
- p = Properties().add("vespa.eval.lazy_expressions", "true");
- EXPECT_TRUE(eval::LazyExpressions::check(p, true));
- EXPECT_TRUE(eval::LazyExpressions::check(p, false));
- p = Properties().add("vespa.eval.lazy_expressions", "false");
- EXPECT_TRUE(!eval::LazyExpressions::check(p, true));
- EXPECT_TRUE(!eval::LazyExpressions::check(p, false));
+ {
+ Properties p;
+ EXPECT_TRUE(eval::LazyExpressions::check(p, true));
+ EXPECT_TRUE(!eval::LazyExpressions::check(p, false));
+ }
+ {
+ Properties p;
+ p.add("vespa.eval.lazy_expressions", "true");
+ EXPECT_TRUE(eval::LazyExpressions::check(p, true));
+ EXPECT_TRUE(eval::LazyExpressions::check(p, false));
+ }
+ {
+ Properties p;
+ p.add("vespa.eval.lazy_expressions", "false");
+ EXPECT_TRUE(!eval::LazyExpressions::check(p, true));
+ EXPECT_TRUE(!eval::LazyExpressions::check(p, false));
+ }
}
{ // vespa.eval.use_fast_forest
EXPECT_EQUAL(eval::UseFastForest::NAME, vespalib::string("vespa.eval.use_fast_forest"));
diff --git a/searchlib/src/tests/nativerank/nativerank.cpp b/searchlib/src/tests/nativerank/nativerank.cpp
index b28e385b597..a929d6b5b23 100644
--- a/searchlib/src/tests/nativerank/nativerank.cpp
+++ b/searchlib/src/tests/nativerank/nativerank.cpp
@@ -228,7 +228,8 @@ Test::testNativeFieldMatch()
EXPECT_TRUE(assertNativeFieldMatch(34, "a%0.1 b%0.4", "x a x x x b"));
// change firstOccImportance
- Properties p = Properties().add("nativeFieldMatch.firstOccurrenceImportance", "1");
+ Properties p;
+ p.add("nativeFieldMatch.firstOccurrenceImportance", "1");
EXPECT_TRUE(assertNativeFieldMatch(100, "a", "a", p));
p.clear().add("nativeFieldMatch.firstOccurrenceImportance", "0");
EXPECT_TRUE(assertNativeFieldMatch(10, "a", "a", p));
@@ -375,7 +376,8 @@ Test::testNativeAttributeMatch()
{ // use table normalization
// foo: max table value: 255
// bar: max table value: 510
- Properties p = Properties().add("nativeRank.useTableNormalization", "true");
+ Properties p;
+ p.add("nativeRank.useTableNormalization", "true");
EXPECT_TRUE(assertNativeAttributeMatch(0.2941, ANAM(100), ANAM(50), p)); // (100/255 + 100/510)*0.5
EXPECT_TRUE(assertNativeAttributeMatch(1, ANAM(255), ANAM(255), p)); // (255/255 + 510/510)*0.5
p.add("nativeAttributeMatch.weightTable.foo", "linear(0,0)");
@@ -630,7 +632,8 @@ Test::testNativeProximity()
EXPECT_TRUE(assertNativeProximity(3.667, "a 0.5:b 1:c", "a b x x c")); // (5*0.5 + 3*1) / (0.5 + 1)
// change proximityImportance
- Properties p = Properties().add("nativeProximity.proximityImportance", "1");
+ Properties p;
+ p.add("nativeProximity.proximityImportance", "1");
EXPECT_TRUE(assertNativeProximity(10, "a b", "a b x x x a", p));
p.clear().add("nativeProximity.proximityImportance", "0");
EXPECT_TRUE(assertNativeProximity(4, "a b", "a b x x x a", p));
diff --git a/searchlib/src/vespa/searchlib/engine/docsumrequest.cpp b/searchlib/src/vespa/searchlib/engine/docsumrequest.cpp
index 0fc258363e5..31ee88d3d69 100644
--- a/searchlib/src/vespa/searchlib/engine/docsumrequest.cpp
+++ b/searchlib/src/vespa/searchlib/engine/docsumrequest.cpp
@@ -16,7 +16,6 @@ DocsumRequest::DocsumRequest(RelativeTime relativeTime, bool useRootSlime_)
: Request(std::move(relativeTime)),
_flags(0u),
resultClassName(),
- useWideHits(false),
_useRootSlime(useRootSlime_),
hits()
{
diff --git a/searchlib/src/vespa/searchlib/engine/docsumrequest.h b/searchlib/src/vespa/searchlib/engine/docsumrequest.h
index 8fe5aa6f465..4849fda8629 100644
--- a/searchlib/src/vespa/searchlib/engine/docsumrequest.h
+++ b/searchlib/src/vespa/searchlib/engine/docsumrequest.h
@@ -8,15 +8,11 @@
#include <vespa/document/base/globalid.h>
#include <vespa/searchlib/common/hitrank.h>
-namespace search::fs4transport { class FS4Packet_GETDOCSUMSX; }
-
namespace search::engine {
class DocsumRequest : public Request
{
public:
- using FS4Packet_GETDOCSUMSX = fs4transport::FS4Packet_GETDOCSUMSX;
-
using UP = std::unique_ptr<DocsumRequest>;
using SP = std::shared_ptr<DocsumRequest>;
using Source = LazySource<DocsumRequest>;
@@ -34,7 +30,6 @@ public:
public:
uint32_t _flags;
vespalib::string resultClassName;
- bool useWideHits;
private:
const bool _useRootSlime;
public:
diff --git a/searchlib/src/vespa/searchlib/engine/propertiesmap.h b/searchlib/src/vespa/searchlib/engine/propertiesmap.h
index a1884e33200..f54b851570e 100644
--- a/searchlib/src/vespa/searchlib/engine/propertiesmap.h
+++ b/searchlib/src/vespa/searchlib/engine/propertiesmap.h
@@ -34,6 +34,8 @@ public:
typedef PropsMap::const_iterator ITR;
PropertiesMap();
+ PropertiesMap(const PropertiesMap &) = delete;
+ PropertiesMap & operator=(const PropertiesMap &) = delete;
~PropertiesMap();
/**
diff --git a/searchlib/src/vespa/searchlib/fef/properties.cpp b/searchlib/src/vespa/searchlib/fef/properties.cpp
index 95b74cd5dfd..e7a69cbcfa7 100644
--- a/searchlib/src/vespa/searchlib/fef/properties.cpp
+++ b/searchlib/src/vespa/searchlib/fef/properties.cpp
@@ -77,6 +77,9 @@ Properties::Properties()
{
}
+Properties::Properties(const Properties &) = default;
+Properties & Properties::operator=(const Properties &) = default;
+
Properties::~Properties()
{
assert(_numValues >= _data.size());
diff --git a/searchlib/src/vespa/searchlib/fef/properties.h b/searchlib/src/vespa/searchlib/fef/properties.h
index 377926509bd..37d29a0ba50 100644
--- a/searchlib/src/vespa/searchlib/fef/properties.h
+++ b/searchlib/src/vespa/searchlib/fef/properties.h
@@ -153,6 +153,10 @@ public:
* Create an empty properties object.
**/
Properties();
+ Properties(Properties &&) noexcept = default;
+ Properties & operator=(Properties &&) noexcept = default;
+ Properties(const Properties &);
+ Properties & operator=(const Properties &);
/**
* The destructor asserts that key/value counts look sane before
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
index 8cc577355cf..0249b96f86b 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp
@@ -18,17 +18,10 @@ struct ExplicitItemData
{
const char *_index;
uint32_t _indexlen;
- const char *_term;
- uint32_t _termlen;
uint32_t _weight;
ExplicitItemData()
- : _index(nullptr), _indexlen(0), _term(nullptr), _termlen(0), _weight(0)
- {}
-
- ExplicitItemData(const char *index, uint32_t indexlen, const char* term,
- uint32_t termlen, uint32_t weight = 0)
- : _index(index), _indexlen(indexlen), _term(term), _termlen(termlen), _weight(weight)
+ : _index(nullptr), _indexlen(0), _weight(0)
{}
};
@@ -86,14 +79,10 @@ TermVisitor::visitProperty(const Property::Value &key, const Property &values)
_visitor->VisitPHRASE(&item, phraseLen);
s = & values.getAt(index++);
while ((*s)[0] != '"') {
- data._term = s->c_str();
- data._termlen = s->length();
_visitor->VisitKeyword(&item, s->c_str(), s->length());
s = & values.getAt(index++);
}
} else {
- data._term = s->c_str();
- data._termlen = s->length();
_visitor->VisitKeyword(&item, s->c_str(), s->length());
}
}
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp
index 0af92adf2d2..c6148cff8b3 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.cpp
@@ -5,38 +5,33 @@
namespace search::docsummary {
GetDocsumArgs::GetDocsumArgs()
- : _ranking(),
- _resultClassName(),
+ : _resultClassName(),
_dumpFeatures(false),
_locations_possible(true),
- _stackItems(0),
_stackDump(),
_location(),
_timeout(30s),
- _propertiesMap()
+ _highlightTerms()
{ }
GetDocsumArgs::~GetDocsumArgs() = default;
void
-GetDocsumArgs::initFromDocsumRequest(const search::engine::DocsumRequest &req)
+GetDocsumArgs::initFromDocsumRequest(const engine::DocsumRequest &req)
{
- _ranking = req.ranking;
- _dumpFeatures = req.dumpFeatures;
- _resultClassName = req.resultClassName;
- _stackItems = req.stackItems;
- _stackDump = req.stackDump;
- _location = req.location;
+ _dumpFeatures = req.dumpFeatures;
+ _resultClassName = req.resultClassName;
+ _stackDump = req.stackDump;
+ _location = req.location;
_locations_possible = true;
- _timeout = req.getTimeLeft();
- _propertiesMap = req.propertiesMap;
+ _timeout = req.getTimeLeft();
+ _highlightTerms = req.propertiesMap.highlightTerms();
}
void
-GetDocsumArgs::SetStackDump(uint32_t stackItems, uint32_t stackDumpLen, const char *stackDump)
+GetDocsumArgs::SetStackDump(uint32_t stackDumpLen, const char *stackDump)
{
- _stackItems = stackItems;
_stackDump.resize(stackDumpLen);
memcpy(&_stackDump[0], stackDump, _stackDump.size());
}
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
index 0231b004674..17b514883d1 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
+++ b/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
@@ -10,28 +10,22 @@ namespace search::docsummary {
class GetDocsumArgs
{
-public:
- typedef engine::PropertiesMap PropsMap;
-
private:
- vespalib::string _ranking;
vespalib::string _resultClassName;
bool _dumpFeatures;
bool _locations_possible;
- uint32_t _stackItems;
std::vector<char> _stackDump;
vespalib::string _location;
vespalib::duration _timeout;
- PropsMap _propertiesMap;
+ fef::Properties _highlightTerms;
public:
GetDocsumArgs();
~GetDocsumArgs();
void initFromDocsumRequest(const search::engine::DocsumRequest &req);
- void SetRankProfile(const vespalib::string &ranking) { _ranking = ranking; }
void setResultClassName(vespalib::stringref name) { _resultClassName = name; }
- void SetStackDump(uint32_t stackItems, uint32_t stackDumpLen, const char *stackDump);
+ void SetStackDump(uint32_t stackDumpLen, const char *stackDump);
void locations_possible(bool value) { _locations_possible = value; }
bool locations_possible() const { return _locations_possible; }
const vespalib::string &getLocation() const { return _location; }
@@ -47,10 +41,8 @@ public:
void dumpFeatures(bool v) { _dumpFeatures = v; }
bool dumpFeatures() const { return _dumpFeatures; }
- const PropsMap &propertiesMap() const { return _propertiesMap; }
-
- const search::fef::Properties &highlightTerms() const {
- return _propertiesMap.highlightTerms();
+ const fef::Properties &highlightTerms() const {
+ return _highlightTerms;
}
};
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index 6f4c17f179b..5e1e95b4681 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -265,11 +265,6 @@ void SearchVisitor::init(const Parameters & params)
LOG(debug, "No rank properties received");
}
- if (params.lookup("rankprofile", valueRef)) {
- vespalib::string tmp(valueRef.data(), valueRef.size());
- _summaryGenerator.getDocsumState()._args.SetRankProfile(tmp);
- }
-
vespalib::string location;
if (params.lookup("location", valueRef)) {
location = vespalib::string(valueRef.data(), valueRef.size());
@@ -299,7 +294,7 @@ void SearchVisitor::init(const Parameters & params)
int stackCount = 0;
if (params.get("querystackcount", stackCount)) {
- _summaryGenerator.getDocsumState()._args.SetStackDump(stackCount, queryBlob.size(), (const char*)queryBlob.data());
+ _summaryGenerator.getDocsumState()._args.SetStackDump(queryBlob.size(), (const char*)queryBlob.data());
} else {
LOG(warning, "Request without query stack count");
}