summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <tegge@vespa.ai>2024-01-24 21:27:53 +0100
committerGitHub <noreply@github.com>2024-01-24 21:27:53 +0100
commita65179e6b66ce6312868d4fd89bf758f714d59dc (patch)
treef9f3999ec8d297a0d8b0e9c4a1f7c4e4e2318052
parentdd9d5bbf74674e17a17d07734da2513a479e4037 (diff)
parent9fe3d7898a2071017caded8b5faa58ef52c53b02 (diff)
Merge pull request #30050 from vespa-engine/toregge/reindent-vsm-strchrfieldsearcher
Reindent vsm::StrChrFieldSearcher.
-rw-r--r--streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
index 98e88e45b3a..ba52444101d 100644
--- a/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
+++ b/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
@@ -25,36 +25,36 @@ void StrChrFieldSearcher::onValue(const document::FieldValue & fv)
bool StrChrFieldSearcher::matchDoc(const FieldRef & fieldRef)
{
- if (_qtl.size() > 1) {
- size_t mintsz = shortestTerm();
- if (fieldRef.size() >= mintsz) {
- _words += matchTerms(fieldRef, mintsz);
+ if (_qtl.size() > 1) {
+ size_t mintsz = shortestTerm();
+ if (fieldRef.size() >= mintsz) {
+ _words += matchTerms(fieldRef, mintsz);
+ } else {
+ _words += countWords(fieldRef);
+ }
} else {
- _words += countWords(fieldRef);
+ for (auto qt : _qtl) {
+ if (fieldRef.size() >= qt->termLen() || qt->isRegex() || qt->isFuzzy()) {
+ _words += matchTerm(fieldRef, *qt);
+ } else {
+ _words += countWords(fieldRef);
+ }
+ }
}
- } else {
- for (auto qt : _qtl) {
- if (fieldRef.size() >= qt->termLen() || qt->isRegex() || qt->isFuzzy()) {
- _words += matchTerm(fieldRef, *qt);
- } else {
- _words += countWords(fieldRef);
- }
- }
- }
- return true;
+ return true;
}
size_t StrChrFieldSearcher::shortestTerm() const
{
- size_t mintsz(_qtl.front()->termLen());
- for (auto it=_qtl.begin()+1, mt=_qtl.end(); it != mt; it++) {
- const QueryTerm & qt = **it;
- if (qt.isRegex() || qt.isFuzzy()) {
- return 0; // Must avoid "too short query term" optimization when using regex or fuzzy
+ size_t mintsz(_qtl.front()->termLen());
+ for (auto it=_qtl.begin()+1, mt=_qtl.end(); it != mt; it++) {
+ const QueryTerm & qt = **it;
+ if (qt.isRegex() || qt.isFuzzy()) {
+ return 0; // Must avoid "too short query term" optimization when using regex or fuzzy
+ }
+ mintsz = std::min(mintsz, qt.termLen());
}
- mintsz = std::min(mintsz, qt.termLen());
- }
- return mintsz;
+ return mintsz;
}
}