diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-16 14:57:03 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-16 14:57:03 +0100 |
commit | 18ed272a525f9e484ced8e6283d633e9246b9a99 (patch) | |
tree | bbfcacaedafdda27574782ccab779d7c7890b0a4 /vsm | |
parent | 928b16135f28fdc15bc63ce180a996f7046d89cd (diff) |
Decouple includes.
Diffstat (limited to 'vsm')
-rw-r--r-- | vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp | 47 | ||||
-rw-r--r-- | vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h | 47 | ||||
-rw-r--r-- | vsm/src/vespa/vsm/searcher/utf8substringsearcher.h | 4 | ||||
-rw-r--r-- | vsm/src/vespa/vsm/vsm/docsumconfig.cpp | 4 | ||||
-rw-r--r-- | vsm/src/vespa/vsm/vsm/docsumconfig.h | 10 | ||||
-rw-r--r-- | vsm/src/vespa/vsm/vsm/docsumfilter.cpp | 2 | ||||
-rw-r--r-- | vsm/src/vespa/vsm/vsm/docsumfilter.h | 2 |
7 files changed, 58 insertions, 58 deletions
diff --git a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp index b2ed570b8b0..1ac019723e1 100644 --- a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp +++ b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp @@ -267,6 +267,53 @@ UTF8StringFieldSearcherBase::isSeparatorCharacter(ucs4_t c) return ((c < 0x20) && (c != '\n') && (c != '\t')); } +template <typename T> +size_t +UTF8StringFieldSearcherBase::skipSeparators(const search::byte * p, size_t sz, T & dstbuf) { + const search::byte * e(p+sz); + const search::byte * b(p); + + for(; p < e; ) { + ucs4_t c(*p); + const search::byte * oldP(p); + if (c < 128) { + p++; + if (!isSeparatorCharacter(c)) { + dstbuf.onCharacter(_foldCase[c], (oldP - b)); + } + } else { + c = Fast_UnicodeUtil::GetUTF8CharNonAscii(p); + const char *repl = ReplacementString(c); + if (repl != NULL) { + size_t repllen = strlen(repl); + if (repllen > 0) { + ucs4_t * buf = dstbuf.getBuf(); + ucs4_t * newBuf = Fast_UnicodeUtil::ucs4copy(buf, repl); + if (dstbuf.hasOffsets()) { + for (; buf < newBuf; ++buf) { + dstbuf.incBuf(1); + dstbuf.onOffset(oldP - b); + } + } else { + dstbuf.incBuf(newBuf - buf); + } + } + } else { + c = ToFold(c); + dstbuf.onCharacter(c, (oldP - b)); + } + if (c == _BadUTF8Char) { + _badUtf8Count++; + } else { + _utf8Count[p-oldP-1]++; + } + } + } + assert(dstbuf.valid()); + return dstbuf.size(); +} +template unsigned long UTF8StringFieldSearcherBase::skipSeparators<UTF8StringFieldSearcherBase::BufferWrapper>(unsigned char const*, unsigned long, UTF8StringFieldSearcherBase::BufferWrapper&); +template unsigned long UTF8StringFieldSearcherBase::skipSeparators<UTF8StringFieldSearcherBase::OffsetWrapper>(unsigned char const*, unsigned long, UTF8StringFieldSearcherBase::OffsetWrapper&); } diff --git a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h index cc433b83e95..a97511cd086 100644 --- a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h +++ b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h @@ -106,8 +106,7 @@ protected: public: UTF8StringFieldSearcherBase(); UTF8StringFieldSearcherBase(FieldIdT fId); - virtual void prepare(search::QueryTermList & qtl, - const SharedSearcherBuf & buf); + void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; /** * Matches the given query term against the given word using suffix match strategy. * @@ -130,49 +129,7 @@ public: * Folding is performed. Separator characters are skipped. **/ template <typename T> - size_t skipSeparators(const search::byte * p, size_t sz, T & dstbuf) { - const search::byte * e(p+sz); - const search::byte * b(p); - - for(; p < e; ) { - ucs4_t c(*p); - const search::byte * oldP(p); - if (c < 128) { - p++; - if (!isSeparatorCharacter(c)) { - dstbuf.onCharacter(_foldCase[c], (oldP - b)); - } - } else { - c = Fast_UnicodeUtil::GetUTF8CharNonAscii(p); - const char *repl = ReplacementString(c); - if (repl != NULL) { - size_t repllen = strlen(repl); - if (repllen > 0) { - ucs4_t * buf = dstbuf.getBuf(); - ucs4_t * newBuf = Fast_UnicodeUtil::ucs4copy(buf, repl); - if (dstbuf.hasOffsets()) { - for (; buf < newBuf; ++buf) { - dstbuf.incBuf(1); - dstbuf.onOffset(oldP - b); - } - } else { - dstbuf.incBuf(newBuf - buf); - } - } - } else { - c = ToFold(c); - dstbuf.onCharacter(c, (oldP - b)); - } - if (c == _BadUTF8Char) { - _badUtf8Count++; - } else { - _utf8Count[p-oldP-1]++; - } - } - } - assert(dstbuf.valid()); - return dstbuf.size(); - } + size_t skipSeparators(const search::byte * p, size_t sz, T & dstbuf); }; diff --git a/vsm/src/vespa/vsm/searcher/utf8substringsearcher.h b/vsm/src/vespa/vsm/searcher/utf8substringsearcher.h index 730f25ebc48..2a89ba9dc2e 100644 --- a/vsm/src/vespa/vsm/searcher/utf8substringsearcher.h +++ b/vsm/src/vespa/vsm/searcher/utf8substringsearcher.h @@ -15,8 +15,8 @@ public: UTF8SubStringFieldSearcher() : UTF8StringFieldSearcherBase() { } UTF8SubStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } protected: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm); + size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; }; } diff --git a/vsm/src/vespa/vsm/vsm/docsumconfig.cpp b/vsm/src/vespa/vsm/vsm/docsumconfig.cpp index 69db4324373..2c140fa56d0 100644 --- a/vsm/src/vespa/vsm/vsm/docsumconfig.cpp +++ b/vsm/src/vespa/vsm/vsm/docsumconfig.cpp @@ -1,9 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Copyright (C) 1998-2003 Fast Search & Transfer ASA -// Copyright (C) 2003 Overture Services Norway AS -#include <vespa/fastos/fastos.h> #include <vespa/vsm/vsm/docsumconfig.h> +#include <vespa/searchsummary/docsummary/docsumfieldwriter.h> using search::docsummary::IDocsumFieldWriter; using search::docsummary::EmptyDFW; diff --git a/vsm/src/vespa/vsm/vsm/docsumconfig.h b/vsm/src/vespa/vsm/vsm/docsumconfig.h index 68272f4339a..d1e9df60fa3 100644 --- a/vsm/src/vespa/vsm/vsm/docsumconfig.h +++ b/vsm/src/vespa/vsm/vsm/docsumconfig.h @@ -11,14 +11,12 @@ namespace vsm { class DynamicDocsumConfig : public search::docsummary::DynamicDocsumConfig { public: - DynamicDocsumConfig(search::docsummary::IDocsumEnvironment * env, search::docsummary::DynamicDocsumWriter * writer) : - search::docsummary::DynamicDocsumConfig(env, writer) - { - } + using Parent = search::docsummary::DynamicDocsumConfig; + using Parent::Parent; private: - virtual search::docsummary::IDocsumFieldWriter::UP + std::unique_ptr<search::docsummary::IDocsumFieldWriter> createFieldWriter(const string & fieldName, const string & overrideName, - const string & cf, bool & rc); + const string & cf, bool & rc) override; }; } diff --git a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp index 566e9296e0b..3584ccae5f9 100644 --- a/vsm/src/vespa/vsm/vsm/docsumfilter.cpp +++ b/vsm/src/vespa/vsm/vsm/docsumfilter.cpp @@ -236,7 +236,7 @@ void DocsumFilter::init(const FieldMap & fieldMap, const FieldPathMapT & fieldPa } uint32_t -DocsumFilter::getNumDocs() +DocsumFilter::getNumDocs() const { return std::numeric_limits<uint32_t>::max(); } diff --git a/vsm/src/vespa/vsm/vsm/docsumfilter.h b/vsm/src/vespa/vsm/vsm/docsumfilter.h index 7014e36f09c..858c2e3f4d3 100644 --- a/vsm/src/vespa/vsm/vsm/docsumfilter.h +++ b/vsm/src/vespa/vsm/vsm/docsumfilter.h @@ -86,7 +86,7 @@ public: // Inherit doc from IDocsumStore DocsumStoreValue getMappedDocsum(uint32_t id, bool useSlimeInsideFields) override; - uint32_t getNumDocs() override; + uint32_t getNumDocs() const override; uint32_t getSummaryClassId() const override; }; |