summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchsummary/src/vespa/juniper/Matcher.cpp3
-rw-r--r--searchsummary/src/vespa/juniper/result.cpp14
-rw-r--r--searchsummary/src/vespa/juniper/sumdesc.cpp1
-rw-r--r--searchsummary/src/vespa/juniper/sumdesc.h4
4 files changed, 10 insertions, 12 deletions
diff --git a/searchsummary/src/vespa/juniper/Matcher.cpp b/searchsummary/src/vespa/juniper/Matcher.cpp
index 32f966f4571..76f4a17ad1c 100644
--- a/searchsummary/src/vespa/juniper/Matcher.cpp
+++ b/searchsummary/src/vespa/juniper/Matcher.cpp
@@ -478,8 +478,7 @@ std::string Matcher::GetLog()
}
-SummaryDesc* Matcher::CreateSummaryDesc(size_t length, size_t min_length, int max_matches,
- int surround_len)
+SummaryDesc* Matcher::CreateSummaryDesc(size_t length, size_t min_length, int max_matches, int surround_len)
{
// No point in processing this document if no keywords found at all:
if (TotalHits() <= 0) return NULL;
diff --git a/searchsummary/src/vespa/juniper/result.cpp b/searchsummary/src/vespa/juniper/result.cpp
index fddc5d65c86..46e33209d52 100644
--- a/searchsummary/src/vespa/juniper/result.cpp
+++ b/searchsummary/src/vespa/juniper/result.cpp
@@ -8,6 +8,7 @@
#include "Matcher.h"
#include "config.h"
#include "appender.h"
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/log/log.h>
LOG_SETUP(".juniper.result");
@@ -18,9 +19,9 @@ namespace juniper {
class SummaryImpl : public Summary
{
public:
- explicit SummaryImpl() : _text("") {}
+ explicit SummaryImpl() : _text() {}
explicit SummaryImpl(const std::string& t) : _text(t) {}
- ~SummaryImpl() {}
+ ~SummaryImpl() override = default;
const char* Text() const override { return _text.c_str(); }
size_t Length() const override { return _text.size(); }
std::string _text;
@@ -96,9 +97,7 @@ Result::Result(const Config& config, QueryHandle& qhandle,
}
}
-Result::~Result()
-{
-}
+Result::~Result() = default;
long Result::GetRelevancy()
@@ -158,13 +157,12 @@ Summary* Result::GetTeaser(const Config* alt_config)
ucs4_t *dst_end = dst + TOKEN_DSTLEN;
const Fast_WordFolder *folder = _config->_matcherparams.WordFolder();
- text.reserve(_dynsum_len*2);
+ text.reserve(std::min(4_Ki, size_t(_dynsum_len*2)));
if (src_end - src <= _dynsum_len) {
a.append(text, src, src_end - src);
src = src_end; // ensure while loop not run
}
- while (src < src_end)
- {
+ while (src < src_end) {
const char *startpos;
size_t tokenLen;
const char *old_src = src;
diff --git a/searchsummary/src/vespa/juniper/sumdesc.cpp b/searchsummary/src/vespa/juniper/sumdesc.cpp
index fcee1eb605f..d6ac5e6e416 100644
--- a/searchsummary/src/vespa/juniper/sumdesc.cpp
+++ b/searchsummary/src/vespa/juniper/sumdesc.cpp
@@ -325,6 +325,7 @@ SummaryDesc::SummaryDesc(Matcher* matcher, ssize_t length, ssize_t min_length,
locate_accidential_matches();
}
+SummaryDesc::~SummaryDesc() = default;
void SummaryDesc::locate_accidential_matches()
diff --git a/searchsummary/src/vespa/juniper/sumdesc.h b/searchsummary/src/vespa/juniper/sumdesc.h
index d91bf160e04..a0440a60fba 100644
--- a/searchsummary/src/vespa/juniper/sumdesc.h
+++ b/searchsummary/src/vespa/juniper/sumdesc.h
@@ -32,8 +32,8 @@ public:
// Constructor that builds a description that can later be used to create
// a suitable query in context / query highlight for the given matcher
// in its current status:
- SummaryDesc(Matcher* matcher, ssize_t length, ssize_t min_length, int max_matches,
- int surround_len);
+ SummaryDesc(Matcher* matcher, ssize_t length, ssize_t min_length, int max_matches, int surround_len);
+ ~SummaryDesc();
/* Return a highlight tagged summary string
* from this summary description