summaryrefslogtreecommitdiffstats
path: root/searchsummary
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 /searchsummary
parent3169f66bf208aa984605fa319046aabccc61c421 (diff)
Add missing move operators that avoid alot of copying when dealing with vectors and maps.
Diffstat (limited to 'searchsummary')
-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
3 files changed, 15 insertions, 39 deletions
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;
}
};