diff options
author | Tor Egge <Tor.Egge@online.no> | 2024-01-24 20:52:34 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2024-01-24 20:52:34 +0100 |
commit | 9fe3d7898a2071017caded8b5faa58ef52c53b02 (patch) | |
tree | 13c917905f41a3c1eed184fd3e0ac35698e83609 | |
parent | 126bdc4405385e7b70e1018d1f28e3aaa7e92e60 (diff) |
Reindent vsm::StrChrFieldSearcher.
-rw-r--r-- | streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp | 46 |
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; } } |