From 4fe271e4b1e4603fb3705a98ec9d61b8baf67cc5 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 21 Sep 2022 18:30:38 +0000 Subject: GC unused files and code. --- searchlib/src/vespa/searchlib/aggregation/fs4hit.h | 1 - searchlib/src/vespa/searchlib/common/base.h | 14 ------ searchlib/src/vespa/searchlib/common/converters.h | 7 +-- searchlib/src/vespa/searchlib/common/docstamp.h | 18 -------- .../vespa/searchlib/common/documentlocations.cpp | 10 ++--- .../src/vespa/searchlib/common/documentlocations.h | 11 ++--- .../src/vespa/searchlib/common/documentsummary.cpp | 5 +-- .../src/vespa/searchlib/common/documentsummary.h | 11 ++--- searchlib/src/vespa/searchlib/common/fslimits.h | 29 ------------ searchlib/src/vespa/searchlib/common/gid.h | 51 ---------------------- searchlib/src/vespa/searchlib/common/reserved.h | 17 -------- .../searchlib/common/serialnumfileheadercontext.h | 9 +--- searchlib/src/vespa/searchlib/common/sortspec.cpp | 18 ++++---- searchlib/src/vespa/searchlib/query/base.h | 31 ------------- .../src/vespa/searchlib/query/streaming/query.cpp | 4 +- .../src/vespa/searchlib/query/streaming/query.h | 7 ++- .../src/vespa/searchvisitor/searchvisitor.cpp | 2 +- .../src/vespa/vsm/searcher/fieldsearcher.cpp | 2 +- 18 files changed, 31 insertions(+), 216 deletions(-) delete mode 100644 searchlib/src/vespa/searchlib/common/base.h delete mode 100644 searchlib/src/vespa/searchlib/common/docstamp.h delete mode 100644 searchlib/src/vespa/searchlib/common/gid.h delete mode 100644 searchlib/src/vespa/searchlib/common/reserved.h diff --git a/searchlib/src/vespa/searchlib/aggregation/fs4hit.h b/searchlib/src/vespa/searchlib/aggregation/fs4hit.h index 7cb078fe7e8..9a3bceb22d4 100644 --- a/searchlib/src/vespa/searchlib/aggregation/fs4hit.h +++ b/searchlib/src/vespa/searchlib/aggregation/fs4hit.h @@ -4,7 +4,6 @@ #include "hit.h" #include "aggregationresult.h" #include -#include namespace search::aggregation { diff --git a/searchlib/src/vespa/searchlib/common/base.h b/searchlib/src/vespa/searchlib/common/base.h deleted file mode 100644 index e59d0a77fb8..00000000000 --- a/searchlib/src/vespa/searchlib/common/base.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -namespace search { - -// This constant defines the illegal/undefined value for unsigned 32-bit -// integer ids. Use this instead of the function below to get less -// overhead with not-so-smart compilers. - -const uint32_t NoId32 = static_cast(-1); - -} - diff --git a/searchlib/src/vespa/searchlib/common/converters.h b/searchlib/src/vespa/searchlib/common/converters.h index a109b501f8c..718f575b4e8 100644 --- a/searchlib/src/vespa/searchlib/common/converters.h +++ b/searchlib/src/vespa/searchlib/common/converters.h @@ -5,8 +5,7 @@ #include #include -namespace search { -namespace common { +namespace search::common { class PassThroughConverter : public BlobConverter { @@ -27,10 +26,8 @@ class ConverterFactory { protected: using stringref = vespalib::stringref; public: - virtual ~ConverterFactory() { } + virtual ~ConverterFactory() = default; virtual BlobConverter::UP create(stringref local, stringref strength) const = 0; }; } -} - diff --git a/searchlib/src/vespa/searchlib/common/docstamp.h b/searchlib/src/vespa/searchlib/common/docstamp.h deleted file mode 100644 index d0515e7d331..00000000000 --- a/searchlib/src/vespa/searchlib/common/docstamp.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -namespace search { - -// since everything is real-time, the docstamp does no longer change -// as before. The value 0 still means invalid , and the -// value 42 was selected randomly to reflect a valid value. Defined -// here for a single source of truth. - -struct DocStamp { - static uint32_t good() { return 42; } - static uint32_t bad() { return 0; } -}; - -} // namespace search - diff --git a/searchlib/src/vespa/searchlib/common/documentlocations.cpp b/searchlib/src/vespa/searchlib/common/documentlocations.cpp index eeddd04b2e5..cd3cb15a446 100644 --- a/searchlib/src/vespa/searchlib/common/documentlocations.cpp +++ b/searchlib/src/vespa/searchlib/common/documentlocations.cpp @@ -4,19 +4,17 @@ #include #include -namespace search { -namespace common { +namespace search::common { DocumentLocations::DocumentLocations() - : _vec(NULL) + : _vec(nullptr) { } -DocumentLocations::~DocumentLocations() { } +DocumentLocations::~DocumentLocations() = default; DocumentLocations::DocumentLocations(DocumentLocations &&) = default; DocumentLocations & DocumentLocations::operator = (DocumentLocations &&) = default; -} // namespace common -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/common/documentlocations.h b/searchlib/src/vespa/searchlib/common/documentlocations.h index ab8de606a43..d1a31a81bdc 100644 --- a/searchlib/src/vespa/searchlib/common/documentlocations.h +++ b/searchlib/src/vespa/searchlib/common/documentlocations.h @@ -4,12 +4,10 @@ #include -namespace search { +namespace search { class AttributeGuard; } +namespace search::attribute { class IAttributeVector; } -namespace attribute { class IAttributeVector; } -class AttributeGuard; - -namespace common { +namespace search::common { /** @@ -37,7 +35,4 @@ public: } }; - } -} - diff --git a/searchlib/src/vespa/searchlib/common/documentsummary.cpp b/searchlib/src/vespa/searchlib/common/documentsummary.cpp index 55ecc558598..36d4ca9b1a8 100644 --- a/searchlib/src/vespa/searchlib/common/documentsummary.cpp +++ b/searchlib/src/vespa/searchlib/common/documentsummary.cpp @@ -2,7 +2,6 @@ #include "documentsummary.h" #include -#include #include #include @@ -11,8 +10,7 @@ LOG_SETUP(".searchlib.docsummary.documentsummary"); using vespalib::getLastErrorString; -namespace search { -namespace docsummary { +namespace search::docsummary { bool DocumentSummary::readDocIdLimit(const vespalib::string &dir, uint32_t &count) @@ -63,4 +61,3 @@ DocumentSummary::writeDocIdLimit(const vespalib::string &dir, uint32_t count) } } -} diff --git a/searchlib/src/vespa/searchlib/common/documentsummary.h b/searchlib/src/vespa/searchlib/common/documentsummary.h index b49bac2cd8d..6444d54a325 100644 --- a/searchlib/src/vespa/searchlib/common/documentsummary.h +++ b/searchlib/src/vespa/searchlib/common/documentsummary.h @@ -4,19 +4,14 @@ #include -namespace search { -namespace docsummary { +namespace search::docsummary { class DocumentSummary { public: - static bool - readDocIdLimit(const vespalib::string &dir, uint32_t &docIdLimit); - - static bool - writeDocIdLimit(const vespalib::string &dir, uint32_t docIdLimit); + static bool readDocIdLimit(const vespalib::string &dir, uint32_t &docIdLimit); + static bool writeDocIdLimit(const vespalib::string &dir, uint32_t docIdLimit); }; } -} diff --git a/searchlib/src/vespa/searchlib/common/fslimits.h b/searchlib/src/vespa/searchlib/common/fslimits.h index 85c2ba0c5ad..ba167503ca2 100644 --- a/searchlib/src/vespa/searchlib/common/fslimits.h +++ b/searchlib/src/vespa/searchlib/common/fslimits.h @@ -2,34 +2,5 @@ #pragma once -// define min/max number of bits that may be used to -// encode partid/rowid into the partition path field. -// NB: MIN_ROWBITS == 0 -// Constraint: MIN_PARTBITS >= 1 -// Constraint: MIN_PARTBITS <= 6 <= MAX_PARTBITS - -#define MIN_PARTBITS 1 -#define MAX_PARTBITS 8 - -#define MAX_ROWBITS 8 - -// Currently, max word length and max number of indexes are limited by -// the layout of binary dictionaries; see class FastS_Pagedict. - -#define MAX_WORD_LEN 1000 -#define MAX_INDEXES 64 - -// max number of tiers in a multi-tier dataset. -// may currently not be greater than 16, due to the -// partition path encoding algorithm used. - -#define MAX_TIERS 16 - -// max number of explicitly defined term rank limits -#define MAX_TERMRANKLIMITS 32 - -// Max number of fallthrough classes in Multi-tier fallthrough selector, just set a limit.. -#define MAX_FALLTHROUGH_SELECTORS 32 - #define SEARCHLIB_FEF_UNKNOWN_FIELD_LENGTH 1000000u diff --git a/searchlib/src/vespa/searchlib/common/gid.h b/searchlib/src/vespa/searchlib/common/gid.h deleted file mode 100644 index 1f73e16ad46..00000000000 --- a/searchlib/src/vespa/searchlib/common/gid.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - - -namespace search { - -class Lid { -public: - Lid() { memset(_lid, 0, sizeof(_lid)); } - Lid(uint32_t l) { lid(l);} - uint32_t lid() const - { - return (_lid[0] << 24) + - (_lid[1] << 16) + - (_lid[2] << 8) + - _lid[3]; - } - void lid(uint32_t v) - { - _lid[0] = (v >> 24) & 0xff; - _lid[1] = (v >> 16) & 0xff; - _lid[2] = (v >> 8) & 0xff; - _lid[3] = v & 0xff; - } - int cmp(const Lid & b) const { return lid() - b.lid(); } -private: - typedef unsigned char LidT[4]; - LidT _lid; -}; - -class Gid { -public: - Gid() { memset(_gid, 0, sizeof(_gid)); } - Gid(const char *g) { memcpy(_gid, g, sizeof(_gid)); } - const char * gid() const { return _gid; } - int cmp(const Gid & b) const { return memcmp(_gid, b._gid, sizeof(_gid)); } -private: - typedef char GidT[12]; - GidT _gid; -}; - -inline bool operator < (const Gid & a, const Gid & b) { return a.cmp(b) < 0; } -inline bool operator <= (const Gid & a, const Gid & b) { return a.cmp(b) <= 0; } -inline bool operator == (const Gid & a, const Gid & b) { return a.cmp(b) == 0; } -inline bool operator != (const Gid & a, const Gid & b) { return a.cmp(b) != 0; } -inline bool operator > (const Gid & a, const Gid & b) { return a.cmp(b) > 0; } -inline bool operator >= (const Gid & a, const Gid & b) { return a.cmp(b) >= 0; } - -} - diff --git a/searchlib/src/vespa/searchlib/common/reserved.h b/searchlib/src/vespa/searchlib/common/reserved.h deleted file mode 100644 index dd2fba58956..00000000000 --- a/searchlib/src/vespa/searchlib/common/reserved.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -// These are used by FAST Web Search for host name anchoring. - -// NB! Should be changed to uppercase once the functionality is implemented!! - -static const char *ANCHOR_START_OF_HOST = "StArThOsT"; -static const char *ANCHOR_END_OF_HOST = "EnDhOsT"; - -// These are used in the query parser when parsing fields with parsemode -// 'boundaries'. Not used otherwise. Lowercased for performance reasons. - -#define ANCHOR_LEFT_BOUNDARY "fastpbfast" -#define ANCHOR_RIGHT_BOUNDARY "fastpbfast" - diff --git a/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h b/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h index ae0eb75a7a1..37953bd9690 100644 --- a/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h +++ b/searchlib/src/vespa/searchlib/common/serialnumfileheadercontext.h @@ -4,9 +4,7 @@ #include "fileheadercontext.h" #include "serialnum.h" -namespace search { - -namespace common { +namespace search::common { class SerialNumFileHeaderContext : public FileHeaderContext { @@ -21,7 +19,4 @@ public: void addTags(vespalib::GenericHeader &header, const vespalib::string &name) const override; }; -} // namespace common - -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/common/sortspec.cpp b/searchlib/src/vespa/searchlib/common/sortspec.cpp index 06f7391b232..99def167460 100644 --- a/searchlib/src/vespa/searchlib/common/sortspec.cpp +++ b/searchlib/src/vespa/searchlib/common/sortspec.cpp @@ -5,13 +5,13 @@ #include #include -namespace search { -namespace common { +namespace search::common { using vespalib::ConstBufferRef; using vespalib::make_string; -ConstBufferRef PassThroughConverter::onConvert(const ConstBufferRef & src) const +ConstBufferRef +PassThroughConverter::onConvert(const ConstBufferRef & src) const { return src; } @@ -21,7 +21,8 @@ LowercaseConverter::LowercaseConverter() : { } -ConstBufferRef LowercaseConverter::onConvert(const ConstBufferRef & src) const +ConstBufferRef +LowercaseConverter::onConvert(const ConstBufferRef & src) const { _buffer.clear(); vespalib::stringref input((const char *)src.data(), src.size()); @@ -32,13 +33,13 @@ ConstBufferRef LowercaseConverter::onConvert(const ConstBufferRef & src) const c = Fast_NormalizeWordFolder::ToFold(c); w.putChar(c); } - return ConstBufferRef(_buffer.begin(), _buffer.size()); + return {_buffer.begin(), _buffer.size()}; } SortInfo::SortInfo(const vespalib::string & field, bool ascending, const BlobConverter::SP & converter) : _field(field), _ascending(ascending), _converter(converter) { } -SortInfo::~SortInfo() {} +SortInfo::~SortInfo() = default; SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFactory) : _spec(spec) @@ -98,13 +99,12 @@ SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFa throw std::runtime_error("Unknown func " + vespalib::string(func, p-func)); } } else { - push_back(SortInfo(funcSpec, ascending, BlobConverter::SP(NULL))); + push_back(SortInfo(funcSpec, ascending, BlobConverter::SP())); } } } } -SortSpec::~SortSpec() {} +SortSpec::~SortSpec() = default; } -} diff --git a/searchlib/src/vespa/searchlib/query/base.h b/searchlib/src/vespa/searchlib/query/base.h index b0341d20c31..733e7d1ce40 100644 --- a/searchlib/src/vespa/searchlib/query/base.h +++ b/searchlib/src/vespa/searchlib/query/base.h @@ -1,50 +1,19 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include -#include - namespace search { /// Type of general unsigned 8 bit data. typedef unsigned char byte; -/// A simple container for the raw querystack. -typedef vespalib::stringref QueryPacketT; /// The type of the local documentId. typedef unsigned DocumentIdT; -/// This is the type of the CollectionId used in the StorageAPI. -typedef uint64_t CollectionIdT; -/// The type to identify a query. -typedef unsigned QueryIdT; -/// The rank type. -typedef unsigned RankT; /// How time type. Used to represent seconds since 1970. typedef unsigned TimeT; -/// Type to identify performance counters. -typedef uint64_t CounterT; -/// Type to identify performance values. -typedef int ValueT; /// This is a 16 byte vector used in SSE2 integer operations. typedef char v16qi __attribute__ ((__vector_size__(16))); /// This is a 2 element uint64_t vector used in SSE2 integer operations. typedef long long v2di __attribute__ ((__vector_size__(16))); -/// A type to represent a list of strings. -typedef std::vector StringListT; -/// A type to represent a vector of 32 bit signed integers. -typedef std::vector Int32ListT; -/// A type to represent a list of document ids. -typedef std::vector DocumentIdList; -/// A debug macro the does "a" when l & the mask is true. The mask is set per file. -#define DEBUG(l, a) { if (l&DEBUGMASK) {a;} } -#ifdef __USE_RAWDEBUG__ - #define RAWDEBUG(a) a -#else - #define RAWDEBUG(a) -#endif -/// A macro avoid warnings for unused parameters. -#define UNUSED_PARAM(p) /// A macro that gives you number of elements in an array. #define NELEMS(a) (sizeof(a)/sizeof(a[0])) diff --git a/searchlib/src/vespa/searchlib/query/streaming/query.cpp b/searchlib/src/vespa/searchlib/query/streaming/query.cpp index 309edf4d472..a2b1c3b5165 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/query.cpp +++ b/searchlib/src/vespa/searchlib/query/streaming/query.cpp @@ -333,7 +333,7 @@ ONearQueryNode::evaluate() const Query::Query() = default; -Query::Query(const QueryNodeResultFactory & factory, const QueryPacketT & queryRep) +Query::Query(const QueryNodeResultFactory & factory, vespalib::stringref queryRep) : _root() { build(factory, queryRep); @@ -345,7 +345,7 @@ Query::evaluate() const { } bool -Query::build(const QueryNodeResultFactory & factory, const QueryPacketT & queryRep) +Query::build(const QueryNodeResultFactory & factory, vespalib::stringref queryRep) { search::SimpleQueryStackDumpIterator stack(queryRep); if (stack.next()) { diff --git a/searchlib/src/vespa/searchlib/query/streaming/query.h b/searchlib/src/vespa/searchlib/query/streaming/query.h index d77bb7f0f65..b3b39ea2b59 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/query.h +++ b/searchlib/src/vespa/searchlib/query/streaming/query.h @@ -3,7 +3,6 @@ #include "queryterm.h" #include -#include namespace search::streaming { @@ -187,9 +186,9 @@ class Query { public: Query(); - Query(const QueryNodeResultFactory & factory, const QueryPacketT & queryRep); + Query(const QueryNodeResultFactory & factory, vespalib::stringref queryRep); /// Will build the query tree - bool build(const QueryNodeResultFactory & factory, const QueryPacketT & queryRep); + bool build(const QueryNodeResultFactory & factory, vespalib::stringref queryRep); /// Will clear the results from the querytree. void reset(); /// Will get all leafnodes. @@ -201,7 +200,7 @@ public: bool evaluate() const; size_t depth() const; size_t width() const; - bool valid() const { return _root.get() != NULL; } + bool valid() const { return _root.get() != nullptr; } const QueryNode & getRoot() const { return *_root; } QueryNode & getRoot() { return *_root; } static QueryNode::UP steal(Query && query) { return std::move(query._root); } diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index bb84d141d99..b4b7a698178 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -350,7 +350,7 @@ void SearchVisitor::init(const Parameters & params) LOG(spam, "Received query blob of %zu bytes", queryBlob.size()); VISITOR_TRACE(9, vespalib::make_string("Setting up for query blob of %zu bytes", queryBlob.size())); QueryTermDataFactory addOnFactory; - _query = Query(addOnFactory, search::QueryPacketT(queryBlob.data(), queryBlob.size())); + _query = Query(addOnFactory, vespalib::stringref(queryBlob.data(), queryBlob.size())); _searchBuffer->reserve(0x10000); int stackCount = 0; diff --git a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp index e69999b160e..7c5348e3f4f 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.cpp @@ -105,7 +105,7 @@ bool FieldSearcher::search(const StorageDocument & doc) return true; } -void FieldSearcher::prepare(QueryTermList & qtl, const SharedSearcherBuf & UNUSED_PARAM(buf)) +void FieldSearcher::prepare(QueryTermList & qtl, const SharedSearcherBuf &) { FieldSearcherBase::prepare(qtl); prepareFieldId(); -- cgit v1.2.3