aboutsummaryrefslogtreecommitdiffstats
path: root/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-15 00:41:29 +0200
committerGitHub <noreply@github.com>2022-05-15 00:41:29 +0200
commit287a799b270200aca440cad376272328128a5054 (patch)
tree3a9dfff58b98898e2e28c0337925f4f04e5eaeb0 /streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
parent2722ce9d1d1ec12d57ebd3833ce37b0958afb752 (diff)
parentdacf557add1c6a3ffab036cdf2f7dfdf9750b22e (diff)
Merge pull request #22605 from vespa-engine/revert-22604-balder/collapse-vsm-into-streamingvisitors
Revert "Collapse vsm into streamingvisitors"
Diffstat (limited to 'streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp')
-rw-r--r--streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
deleted file mode 100644
index 1c4ff78ff4a..00000000000
--- a/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "strchrfieldsearcher.h"
-#include <vespa/document/fieldvalue/stringfieldvalue.h>
-
-using search::streaming::QueryTerm;
-using search::streaming::QueryTermList;
-
-namespace vsm {
-
-void StrChrFieldSearcher::prepare(QueryTermList & qtl, const SharedSearcherBuf & buf)
-{
- FieldSearcher::prepare(qtl, buf);
-}
-
-void StrChrFieldSearcher::onValue(const document::FieldValue & fv)
-{
- const document::LiteralFieldValueB & sfv = static_cast<const document::LiteralFieldValueB &>(fv);
- vespalib::stringref val = sfv.getValueRef();
- FieldRef fr(val.data(), std::min(maxFieldLength(), val.size()));
- matchDoc(fr);
-}
-
-bool StrChrFieldSearcher::matchDoc(const FieldRef & fieldRef)
-{
- bool retval(true);
- if (_qtl.size() > 1) {
- size_t mintsz = shortestTerm();
- if (fieldRef.size() >= mintsz) {
- _words += matchTerms(fieldRef, mintsz);
- } else {
- _words += countWords(fieldRef);
- }
- } else {
- for(QueryTermList::iterator it=_qtl.begin(), mt=_qtl.end(); it != mt; it++) {
- QueryTerm & qt = **it;
- if (fieldRef.size() >= qt.termLen()) {
- _words += matchTerm(fieldRef, qt);
- } else {
- _words += countWords(fieldRef);
- }
- }
- }
- return retval;
-}
-
-size_t StrChrFieldSearcher::shortestTerm() const
-{
- size_t mintsz(_qtl.front()->termLen());
- for(QueryTermList::const_iterator it=_qtl.begin()+1, mt=_qtl.end(); it != mt; it++) {
- const QueryTerm & qt = **it;
- mintsz = std::min(mintsz, qt.termLen());
- }
- return mintsz;
-}
-
-}