aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-07-26 03:33:15 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-07-27 09:39:26 +0000
commit006f5d16fd9e5a4010c0b1068a7b96fa35136a8c (patch)
treeea4341408151483e6f9cc7a4d960fa39683922d5 /searchlib
parent2b43a46817cc779dccedd82ea8460802367a448a (diff)
- Pack data closer to let config fit in 2 cache lines instead of 4.
- Avoid plt indirection and allow more inlining of frequently called code. - Reapplication of #27646
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp2
-rw-r--r--searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp2
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/basictype.h38
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/collectiontype.h54
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/config.cpp6
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/config.h42
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/distance_metric.h4
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/persistent_predicate_params.h25
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/predicate_params.h13
-rw-r--r--searchlib/src/vespa/searchcommon/common/dictionary_config.h9
-rw-r--r--searchlib/src/vespa/searchcommon/common/growstrategy.h8
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/string_search_helper.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/string_search_helper.h2
-rw-r--r--searchlib/src/vespa/searchlib/fef/properties.cpp22
-rw-r--r--searchlib/src/vespa/searchlib/fef/properties.h42
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/blueprint.cpp26
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/blueprint.h96
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/field_spec.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/field_spec.h38
21 files changed, 218 insertions, 225 deletions
diff --git a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp
index c5d70109015..79ef6e42bb2 100644
--- a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp
+++ b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp
@@ -123,7 +123,7 @@ void hammerAttribute(AttributePtr &v, DocIdRange range, uint32_t count)
Config compactAddressSpaceAttributeConfig(bool enableAddressSpaceCompact)
{
Config cfg(BasicType::INT8, CollectionType::ARRAY);
- cfg.setCompactionStrategy({ 1.0, (enableAddressSpaceCompact ? 0.2 : 1.0) });
+ cfg.setCompactionStrategy({ 1.0f, (enableAddressSpaceCompact ? 0.2f : 1.0f) });
return cfg;
}
diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
index 3b023ed3bc8..c76f73e7477 100644
--- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
+++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
@@ -1005,7 +1005,7 @@ TEST_F("require that lid space can be increased after being compacted and then s
TEST_F("require that there is control of static memory usage", Fixture)
{
vespalib::MemoryUsage usage = f.store.getMemoryUsage();
- EXPECT_EQUAL(536u + sizeof(LogDataStore::NameIdSet) + sizeof(std::mutex), sizeof(LogDataStore));
+ EXPECT_EQUAL(520u + sizeof(LogDataStore::NameIdSet) + sizeof(std::mutex), sizeof(LogDataStore));
EXPECT_EQUAL(74108u, usage.allocatedBytes());
EXPECT_EQUAL(384u, usage.usedBytes());
}
diff --git a/searchlib/src/vespa/searchcommon/attribute/basictype.h b/searchlib/src/vespa/searchcommon/attribute/basictype.h
index 46387dd2738..407348fea92 100644
--- a/searchlib/src/vespa/searchcommon/attribute/basictype.h
+++ b/searchlib/src/vespa/searchcommon/attribute/basictype.h
@@ -9,7 +9,7 @@ namespace search::attribute {
class BasicType
{
public:
- enum Type {
+ enum Type : uint8_t {
NONE = 0,
STRING = 1,
BOOL = 2,
@@ -28,33 +28,33 @@ class BasicType
MAX_TYPE
};
- explicit BasicType(int t) : _type(Type(t)) { }
- explicit BasicType(unsigned int t) : _type(Type(t)) { }
- BasicType(Type t) : _type(t) { }
+ explicit BasicType(int t) noexcept : _type(Type(t)) { }
+ explicit BasicType(unsigned int t) noexcept : _type(Type(t)) { }
+ BasicType(Type t) noexcept : _type(t) { }
explicit BasicType(const vespalib::string & t) : _type(asType(t)) { }
- Type type() const { return _type; }
- const char * asString() const { return asString(_type); }
- size_t fixedSize() const { return fixedSize(_type); }
- static BasicType fromType(bool) { return BOOL; }
- static BasicType fromType(int8_t) { return INT8; }
- static BasicType fromType(int16_t) { return INT16; }
- static BasicType fromType(int32_t) { return INT32; }
- static BasicType fromType(int64_t) { return INT64; }
- static BasicType fromType(float) { return FLOAT; }
- static BasicType fromType(double) { return DOUBLE; }
- bool operator==(const BasicType &b) const { return _type == b._type; }
- bool operator!=(const BasicType &b) const { return _type != b._type; }
+ Type type() const noexcept { return _type; }
+ const char * asString() const noexcept { return asString(_type); }
+ size_t fixedSize() const noexcept { return fixedSize(_type); }
+ static BasicType fromType(bool) noexcept { return BOOL; }
+ static BasicType fromType(int8_t) noexcept { return INT8; }
+ static BasicType fromType(int16_t) noexcept { return INT16; }
+ static BasicType fromType(int32_t) noexcept { return INT32; }
+ static BasicType fromType(int64_t) noexcept { return INT64; }
+ static BasicType fromType(float) noexcept { return FLOAT; }
+ static BasicType fromType(double) noexcept { return DOUBLE; }
+ bool operator==(const BasicType &b) const noexcept { return _type == b._type; }
+ bool operator!=(const BasicType &b) const noexcept { return _type != b._type; }
private:
- static const char * asString(Type t) { return _typeTable[t]._name; }
- static size_t fixedSize(Type t) { return _typeTable[t]._fixedSize; }
+ static const char * asString(Type t) noexcept { return _typeTable[t]._name; }
+ static size_t fixedSize(Type t) noexcept { return _typeTable[t]._fixedSize; }
static Type asType(const vespalib::string & t);
Type _type;
struct TypeInfo {
- Type _type;
+ Type _type;
unsigned int _fixedSize;
const char * _name;
};
diff --git a/searchlib/src/vespa/searchcommon/attribute/collectiontype.h b/searchlib/src/vespa/searchcommon/attribute/collectiontype.h
index 35cb7612ed0..05fad8cbc64 100644
--- a/searchlib/src/vespa/searchcommon/attribute/collectiontype.h
+++ b/searchlib/src/vespa/searchcommon/attribute/collectiontype.h
@@ -9,7 +9,7 @@ namespace search::attribute {
class CollectionType
{
public:
- enum Type {
+ enum Type : uint8_t {
/**
* Single value type with one value stored for each document.
**/
@@ -26,32 +26,30 @@ class CollectionType
MAX_TYPE
};
- CollectionType(Type t = SINGLE, bool remove = false, bool create = false) :
- _type(t),
- _removeIfZero(remove),
- _createIfNonExistant(create)
- {
- }
+ CollectionType(Type t = SINGLE, bool remove = false, bool create = false) noexcept
+ : _type(t),
+ _removeIfZero(remove),
+ _createIfNonExistant(create)
+ { }
explicit
- CollectionType(const vespalib::string & t, bool remove = false, bool create = false) :
- _type(asType(t)),
- _removeIfZero(remove),
- _createIfNonExistant(create)
- {
- }
+ CollectionType(const vespalib::string & t, bool remove = false, bool create = false)
+ : _type(asType(t)),
+ _removeIfZero(remove),
+ _createIfNonExistant(create)
+ { }
- Type type() const { return _type; }
- bool isMultiValue() const { return _type != SINGLE; }
- bool isWeightedSet() const { return _type == WSET; }
- bool isArray() const { return _type == ARRAY; }
- bool removeIfZero() const { return _removeIfZero; }
- bool createIfNonExistant() const { return _createIfNonExistant; }
- const char * asString() const { return asString(_type); }
- void removeIfZero(bool newValue) { _removeIfZero = newValue; }
- void createIfNonExistant(bool newValue) { _createIfNonExistant = newValue; }
- bool operator!=(const CollectionType &b) const { return !(operator==(b)); }
- bool operator==(const CollectionType &b) const {
+ Type type() const noexcept { return _type; }
+ bool isMultiValue() const noexcept { return _type != SINGLE; }
+ bool isWeightedSet() const noexcept { return _type == WSET; }
+ bool isArray() const noexcept { return _type == ARRAY; }
+ bool removeIfZero() const noexcept { return _removeIfZero; }
+ bool createIfNonExistant() const noexcept { return _createIfNonExistant; }
+ const char * asString() const noexcept { return asString(_type); }
+ void removeIfZero(bool newValue) noexcept { _removeIfZero = newValue; }
+ void createIfNonExistant(bool newValue) noexcept { _createIfNonExistant = newValue; }
+ bool operator!=(const CollectionType &b) const noexcept { return !(operator==(b)); }
+ bool operator==(const CollectionType &b) const noexcept {
return _type == b._type &&
_removeIfZero == b._removeIfZero &&
_createIfNonExistant == b._createIfNonExistant;
@@ -63,12 +61,12 @@ class CollectionType
const char * _name;
};
- static const char * asString(Type t) { return _typeTable[t]._name; }
+ static const char * asString(Type t) noexcept { return _typeTable[t]._name; }
static Type asType(const vespalib::string &t);
- Type _type;
- bool _removeIfZero;
- bool _createIfNonExistant;
+ Type _type : 4;
+ bool _removeIfZero : 1;
+ bool _createIfNonExistant : 1;
static const TypeInfo _typeTable[MAX_TYPE];
};
diff --git a/searchlib/src/vespa/searchcommon/attribute/config.cpp b/searchlib/src/vespa/searchcommon/attribute/config.cpp
index af29bd64ad6..7c302a10731 100644
--- a/searchlib/src/vespa/searchcommon/attribute/config.cpp
+++ b/searchlib/src/vespa/searchcommon/attribute/config.cpp
@@ -23,14 +23,14 @@ Config::Config(BasicType bt, CollectionType ct, bool fastSearch_) noexcept
_fastAccess(false),
_mutable(false),
_paged(false),
- _maxUnCommittedMemory(MAX_UNCOMMITTED_MEMORY),
+ _distance_metric(DistanceMetric::Euclidean),
_match(Match::UNCASED),
_dictionary(),
+ _maxUnCommittedMemory(MAX_UNCOMMITTED_MEMORY),
_growStrategy(),
_compactionStrategy(),
_predicateParams(),
_tensorType(vespalib::eval::ValueType::error_type()),
- _distance_metric(DistanceMetric::Euclidean),
_hnsw_index_params()
{
}
@@ -42,7 +42,7 @@ Config & Config::operator = (Config &&) noexcept = default;
Config::~Config() = default;
bool
-Config::operator==(const Config &b) const
+Config::operator==(const Config &b) const noexcept
{
return _basicType == b._basicType &&
_type == b._type &&
diff --git a/searchlib/src/vespa/searchcommon/attribute/config.h b/searchlib/src/vespa/searchcommon/attribute/config.h
index b368885240c..17c762267cc 100644
--- a/searchlib/src/vespa/searchcommon/attribute/config.h
+++ b/searchlib/src/vespa/searchcommon/attribute/config.h
@@ -21,7 +21,7 @@ namespace search::attribute {
*/
class Config {
public:
- enum class Match { CASED, UNCASED };
+ enum class Match : uint8_t { CASED, UNCASED };
using CompactionStrategy = vespalib::datastore::CompactionStrategy;
Config() noexcept;
Config(BasicType bt) noexcept : Config(bt, CollectionType::SINGLE) { }
@@ -33,27 +33,27 @@ public:
Config & operator = (Config &&) noexcept;
~Config();
- BasicType basicType() const { return _basicType; }
- CollectionType collectionType() const { return _type; }
- bool fastSearch() const { return _fastSearch; }
- bool paged() const { return _paged; }
- const PredicateParams &predicateParams() const { return _predicateParams; }
- const vespalib::eval::ValueType & tensorType() const { return _tensorType; }
- DistanceMetric distance_metric() const { return _distance_metric; }
+ BasicType basicType() const noexcept { return _basicType; }
+ CollectionType collectionType() const noexcept { return _type; }
+ bool fastSearch() const noexcept { return _fastSearch; }
+ bool paged() const noexcept { return _paged; }
+ const PredicateParams &predicateParams() const noexcept { return _predicateParams; }
+ const vespalib::eval::ValueType & tensorType() const noexcept { return _tensorType; }
+ DistanceMetric distance_metric() const noexcept { return _distance_metric; }
const std::optional<HnswIndexParams>& hnsw_index_params() const { return _hnsw_index_params; }
/**
* Check if attribute posting list can consist of only a bitvector with
* no corresponding btree.
*/
- bool getIsFilter() const { return _isFilter; }
- bool isMutable() const { return _mutable; }
+ bool getIsFilter() const noexcept { return _isFilter; }
+ bool isMutable() const noexcept { return _mutable; }
/**
* Check if this attribute should be fast accessible at all times.
* If so, attribute is kept in memory also for non-searchable documents.
*/
- bool fastAccess() const { return _fastAccess; }
+ bool fastAccess() const noexcept { return _fastAccess; }
const GrowStrategy & getGrowStrategy() const { return _growStrategy; }
const CompactionStrategy &getCompactionStrategy() const { return _compactionStrategy; }
@@ -92,28 +92,28 @@ public:
}
Config & set_dictionary_config(const DictionaryConfig & cfg) { _dictionary = cfg; return *this; }
Config & set_match(Match match) { _match = match; return *this; }
- bool operator!=(const Config &b) const { return !(operator==(b)); }
- bool operator==(const Config &b) const;
+ bool operator!=(const Config &b) const noexcept { return !(operator==(b)); }
+ bool operator==(const Config &b) const noexcept ;
- uint64_t getMaxUnCommittedMemory() const { return _maxUnCommittedMemory; }
+ uint64_t getMaxUnCommittedMemory() const noexcept { return _maxUnCommittedMemory; }
Config & setMaxUnCommittedMemory(uint64_t value) { _maxUnCommittedMemory = value; return *this; }
private:
BasicType _basicType;
CollectionType _type;
- bool _fastSearch;
- bool _isFilter;
- bool _fastAccess;
- bool _mutable;
- bool _paged;
- uint64_t _maxUnCommittedMemory;
+ bool _fastSearch : 1;
+ bool _isFilter : 1;
+ bool _fastAccess : 1;
+ bool _mutable : 1;
+ bool _paged : 1;
+ DistanceMetric _distance_metric;
Match _match;
DictionaryConfig _dictionary;
+ uint64_t _maxUnCommittedMemory;
GrowStrategy _growStrategy;
CompactionStrategy _compactionStrategy;
PredicateParams _predicateParams;
vespalib::eval::ValueType _tensorType;
- DistanceMetric _distance_metric;
std::optional<HnswIndexParams> _hnsw_index_params;
};
diff --git a/searchlib/src/vespa/searchcommon/attribute/distance_metric.h b/searchlib/src/vespa/searchcommon/attribute/distance_metric.h
index 9f9f45810b9..35f5fb4fe6b 100644
--- a/searchlib/src/vespa/searchcommon/attribute/distance_metric.h
+++ b/searchlib/src/vespa/searchcommon/attribute/distance_metric.h
@@ -2,8 +2,10 @@
#pragma once
+#include <cstdint>
+
namespace search::attribute {
-enum class DistanceMetric { Euclidean, Angular, GeoDegrees, InnerProduct, Hamming, PrenormalizedAngular, Dotproduct };
+enum DistanceMetric : uint8_t { Euclidean, Angular, GeoDegrees, InnerProduct, Hamming, PrenormalizedAngular, Dotproduct };
}
diff --git a/searchlib/src/vespa/searchcommon/attribute/persistent_predicate_params.h b/searchlib/src/vespa/searchcommon/attribute/persistent_predicate_params.h
index d81eb9c5d3c..205a75c188f 100644
--- a/searchlib/src/vespa/searchcommon/attribute/persistent_predicate_params.h
+++ b/searchlib/src/vespa/searchcommon/attribute/persistent_predicate_params.h
@@ -10,24 +10,23 @@ namespace search::attribute {
* Persistent parameters for predicate attributes.
*/
class PersistentPredicateParams {
- uint32_t _arity;
int64_t _lower_bound;
int64_t _upper_bound;
+ uint32_t _arity;
public:
- PersistentPredicateParams()
- : _arity(8),
- _lower_bound(std::numeric_limits<int64_t>::min()),
- _upper_bound(std::numeric_limits<int64_t>::max())
- {
- }
- uint32_t arity() const { return _arity; }
- int64_t lower_bound() const { return _lower_bound; }
- int64_t upper_bound() const { return _upper_bound; }
- void setArity(uint32_t v) { _arity = v; }
- void setBounds(int64_t lower, int64_t upper) { _lower_bound = lower; _upper_bound = upper; }
+ PersistentPredicateParams() noexcept
+ : _lower_bound(std::numeric_limits<int64_t>::min()),
+ _upper_bound(std::numeric_limits<int64_t>::max()),
+ _arity(8)
+ { }
+ uint32_t arity() const noexcept { return _arity; }
+ int64_t lower_bound() const noexcept { return _lower_bound; }
+ int64_t upper_bound() const noexcept { return _upper_bound; }
+ void setArity(uint32_t v) noexcept { _arity = v; }
+ void setBounds(int64_t lower, int64_t upper) noexcept { _lower_bound = lower; _upper_bound = upper; }
- bool operator==(const PersistentPredicateParams &rhs) const {
+ bool operator==(const PersistentPredicateParams &rhs) const noexcept {
return ((_arity == rhs._arity) &&
(_lower_bound == rhs._lower_bound) &&
(_upper_bound == rhs._upper_bound));
diff --git a/searchlib/src/vespa/searchcommon/attribute/predicate_params.h b/searchlib/src/vespa/searchcommon/attribute/predicate_params.h
index 133b7331689..7e9258ab5db 100644
--- a/searchlib/src/vespa/searchcommon/attribute/predicate_params.h
+++ b/searchlib/src/vespa/searchcommon/attribute/predicate_params.h
@@ -11,17 +11,16 @@ namespace search::attribute {
*/
class PredicateParams : public PersistentPredicateParams
{
- double _dense_posting_list_threshold;
+ float _dense_posting_list_threshold;
public:
- PredicateParams()
+ PredicateParams() noexcept
: PersistentPredicateParams(),
_dense_posting_list_threshold(0.4)
- {
- }
+ { }
- double dense_posting_list_threshold() const { return _dense_posting_list_threshold; }
- void setDensePostingListThreshold(double v) { _dense_posting_list_threshold = v; }
- bool operator==(const PredicateParams &rhs) const {
+ float dense_posting_list_threshold() const noexcept { return _dense_posting_list_threshold; }
+ void setDensePostingListThreshold(float v) noexcept { _dense_posting_list_threshold = v; }
+ bool operator==(const PredicateParams &rhs) const noexcept {
return (PersistentPredicateParams::operator==(rhs) &&
(_dense_posting_list_threshold == rhs._dense_posting_list_threshold));
}
diff --git a/searchlib/src/vespa/searchcommon/common/dictionary_config.h b/searchlib/src/vespa/searchcommon/common/dictionary_config.h
index f51341ad799..f504439c5a3 100644
--- a/searchlib/src/vespa/searchcommon/common/dictionary_config.h
+++ b/searchlib/src/vespa/searchcommon/common/dictionary_config.h
@@ -3,6 +3,7 @@
#pragma once
#include <iosfwd>
+#include <cstdint>
namespace search {
@@ -11,8 +12,8 @@ namespace search {
*/
class DictionaryConfig {
public:
- enum class Type { BTREE, HASH, BTREE_AND_HASH };
- enum class Match { CASED, UNCASED };
+ enum class Type : uint8_t { BTREE, HASH, BTREE_AND_HASH };
+ enum class Match : uint8_t { CASED, UNCASED };
DictionaryConfig() noexcept : _type(Type::BTREE), _match(Match::UNCASED) {}
DictionaryConfig(Type type) noexcept : _type(type), _match(Match::UNCASED) {}
DictionaryConfig(Type type, Match match) noexcept : _type(type), _match(match) {}
@@ -20,8 +21,8 @@ public:
Match getMatch() const { return _match; }
bool operator == (const DictionaryConfig & b) const { return (_type == b._type) && (_match == b._match); }
private:
- Type _type;
- Match _match;
+ Type _type : 4;
+ Match _match : 4;
};
std::ostream& operator<<(std::ostream& os, const DictionaryConfig & cfg);
diff --git a/searchlib/src/vespa/searchcommon/common/growstrategy.h b/searchlib/src/vespa/searchcommon/common/growstrategy.h
index 8766989ded0..86750eafbfc 100644
--- a/searchlib/src/vespa/searchcommon/common/growstrategy.h
+++ b/searchlib/src/vespa/searchcommon/common/growstrategy.h
@@ -23,17 +23,17 @@ public:
{
}
- static GrowStrategy make(uint32_t docsInitialCapacity, float docsGrowFactor, uint32_t docsGrowDelta) {
+ static GrowStrategy make(uint32_t docsInitialCapacity, float docsGrowFactor, uint32_t docsGrowDelta) noexcept {
return {docsInitialCapacity, docsGrowFactor, docsGrowDelta, 0, 0.2};
}
- float getMultiValueAllocGrowFactor() const { return _multiValueAllocGrowFactor; }
+ float getMultiValueAllocGrowFactor() const noexcept { return _multiValueAllocGrowFactor; }
- bool operator==(const GrowStrategy & rhs) const {
+ bool operator==(const GrowStrategy & rhs) const noexcept {
return vespalib::GrowStrategy::operator==(rhs) &&
(_multiValueAllocGrowFactor == rhs._multiValueAllocGrowFactor);
}
- bool operator!=(const GrowStrategy & rhs) const {
+ bool operator!=(const GrowStrategy & rhs) const noexcept {
return !(operator==(rhs));
}
};
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 859c607e9cb..3d5f2ec09fd 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -128,6 +128,8 @@ bool AttributeVector::hasArrayType() const { return _config->collectionType().is
bool AttributeVector::getIsFilter() const { return _config->getIsFilter(); }
bool AttributeVector::getIsFastSearch() const { return _config->fastSearch(); }
bool AttributeVector::isMutable() const { return _config->isMutable(); }
+attribute::BasicType::Type AttributeVector::getBasicType() const { return _config->basicType().type(); }
+attribute::CollectionType::Type AttributeVector::getCollectionType() const { return _config->collectionType().type(); }
bool
AttributeVector::isEnumerated(const vespalib::GenericHeader &header)
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 5fd6cb915fa..68dfe52643f 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -319,8 +319,8 @@ public:
AddressSpaceUsage getAddressSpaceUsage() const;
- BasicType::Type getBasicType() const override final { return getInternalBasicType().type(); }
- CollectionType::Type getCollectionType() const override final { return getInternalCollectionType().type(); }
+ BasicType::Type getBasicType() const override final;
+ CollectionType::Type getCollectionType() const override final;
uint32_t getCommittedDocIdLimit() const override final { return _committedDocIdLimit.load(std::memory_order_acquire); }
bool isImported() const override;
diff --git a/searchlib/src/vespa/searchlib/attribute/string_search_helper.cpp b/searchlib/src/vespa/searchlib/attribute/string_search_helper.cpp
index 17a0e6256d4..6e56f5477c2 100644
--- a/searchlib/src/vespa/searchlib/attribute/string_search_helper.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/string_search_helper.cpp
@@ -41,7 +41,7 @@ StringSearchHelper::StringSearchHelper(StringSearchHelper&&) noexcept = default;
StringSearchHelper::~StringSearchHelper() = default;
bool
-StringSearchHelper::isMatch(const char *src) const {
+StringSearchHelper::isMatch(const char *src) const noexcept {
if (__builtin_expect(isRegex(), false)) {
return getRegex().valid() && getRegex().partial_match(std::string_view(src));
}
diff --git a/searchlib/src/vespa/searchlib/attribute/string_search_helper.h b/searchlib/src/vespa/searchlib/attribute/string_search_helper.h
index ee68053122f..b0ce5dff2e0 100644
--- a/searchlib/src/vespa/searchlib/attribute/string_search_helper.h
+++ b/searchlib/src/vespa/searchlib/attribute/string_search_helper.h
@@ -21,7 +21,7 @@ public:
StringSearchHelper(const StringSearchHelper &) = delete;
StringSearchHelper & operator =(const StringSearchHelper &) = delete;
~StringSearchHelper();
- bool isMatch(const char *src) const;
+ bool isMatch(const char *src) const noexcept;
bool isPrefix() const noexcept { return _isPrefix; }
bool isRegex() const noexcept { return _isRegex; }
bool isCased() const noexcept { return _isCased; }
diff --git a/searchlib/src/vespa/searchlib/fef/properties.cpp b/searchlib/src/vespa/searchlib/fef/properties.cpp
index 6f334630dc5..2cc4e50b593 100644
--- a/searchlib/src/vespa/searchlib/fef/properties.cpp
+++ b/searchlib/src/vespa/searchlib/fef/properties.cpp
@@ -11,7 +11,7 @@ const Property::Value Property::_emptyValue;
const Property::Values Property::_emptyValues;
const Property::Value &
-Property::getAt(uint32_t idx) const
+Property::getAt(uint32_t idx) const noexcept
{
if (idx < (*_values).size()) {
return (*_values)[idx];
@@ -22,7 +22,7 @@ Property::getAt(uint32_t idx) const
//-----------------------------------------------------------------------------
uint32_t
-Properties::rawHash(const void *buf, uint32_t len)
+Properties::rawHash(const void *buf, uint32_t len) noexcept
{
uint32_t res = 0;
unsigned const char *pt = (unsigned const char *) buf;
@@ -33,7 +33,7 @@ Properties::rawHash(const void *buf, uint32_t len)
return res;
}
-Properties::Properties()
+Properties::Properties() noexcept
: _numValues(0),
_data()
{
@@ -59,7 +59,7 @@ Properties::add(vespalib::stringref key, vespalib::stringref value)
}
uint32_t
-Properties::count(vespalib::stringref key) const
+Properties::count(vespalib::stringref key) const noexcept
{
if (!key.empty()) {
auto node = _data.find(key);
@@ -112,14 +112,14 @@ Properties::clear()
}
bool
-Properties::operator==(const Properties &rhs) const
+Properties::operator==(const Properties &rhs) const noexcept
{
return (_numValues == rhs._numValues &&
_data == rhs._data);
}
uint32_t
-Properties::hashCode() const
+Properties::hashCode() const noexcept
{
uint32_t hash = numKeys() + numValues();
for (const auto& elem : _data) {
@@ -159,7 +159,7 @@ Properties::visitNamespace(vespalib::stringref ns,
}
Property
-Properties::lookup(vespalib::stringref key) const
+Properties::lookup(vespalib::stringref key) const noexcept
{
if (key.empty()) {
return Property();
@@ -172,7 +172,7 @@ Properties::lookup(vespalib::stringref key) const
}
Property Properties::lookup(vespalib::stringref namespace1,
- vespalib::stringref key) const
+ vespalib::stringref key) const noexcept
{
if (namespace1.empty() || key.empty()) {
return Property();
@@ -184,7 +184,7 @@ Property Properties::lookup(vespalib::stringref namespace1,
Property Properties::lookup(vespalib::stringref namespace1,
vespalib::stringref namespace2,
- vespalib::stringref key) const
+ vespalib::stringref key) const noexcept
{
if (namespace1.empty() || namespace2.empty() || key.empty()) {
return Property();
@@ -197,7 +197,7 @@ Property Properties::lookup(vespalib::stringref namespace1,
Property Properties::lookup(vespalib::stringref namespace1,
vespalib::stringref namespace2,
vespalib::stringref namespace3,
- vespalib::stringref key) const
+ vespalib::stringref key) const noexcept
{
if (namespace1.empty() || namespace2.empty() || namespace3.empty() || key.empty()) {
return Property();
@@ -207,7 +207,7 @@ Property Properties::lookup(vespalib::stringref namespace1,
return lookup(fullKey);
}
-void Properties::swap(Properties & rhs)
+void Properties::swap(Properties & rhs) noexcept
{
_data.swap(rhs._data);
std::swap(_numValues, rhs._numValues);
diff --git a/searchlib/src/vespa/searchlib/fef/properties.h b/searchlib/src/vespa/searchlib/fef/properties.h
index a6ae83b0339..80e8c70939c 100644
--- a/searchlib/src/vespa/searchlib/fef/properties.h
+++ b/searchlib/src/vespa/searchlib/fef/properties.h
@@ -37,7 +37,7 @@ private:
*
* @param values the values for this property
**/
- Property(const Values &values) : _values(&values) { }
+ Property(const Values &values) noexcept : _values(&values) { }
public:
/**
@@ -46,14 +46,14 @@ public:
* object on the stack in the application, and will also be used
* by the @ref Properties class when a lookup gives no results.
**/
- Property() : _values(&_emptyValues) { }
+ Property() noexcept : _values(&_emptyValues) { }
/**
* Check if we found what we were looking for or not.
*
* @return true if the key we looked up had at least one value
**/
- bool found() const {
+ bool found() const noexcept {
return !(*_values).empty();
}
@@ -63,7 +63,7 @@ public:
*
* @return first value for the looked up key, or ""
**/
- const Value &get() const {
+ const Value &get() const noexcept {
if ((*_values).empty()) {
return _emptyValue;
}
@@ -78,7 +78,7 @@ public:
* @return first value for the looked up key, or fallBack
* @param fallBack value to return if no values were found
**/
- const Value & get(const Value &fallBack) const {
+ const Value & get(const Value &fallBack) const noexcept {
if ((*_values).empty()) {
return fallBack;
}
@@ -90,7 +90,7 @@ public:
*
* @return number of values for this property
**/
- uint32_t size() const { return (*_values).size(); }
+ uint32_t size() const noexcept { return (*_values).size(); }
/**
* Obtain a specific value for the looked up key.
@@ -98,7 +98,7 @@ public:
* @return the requested value, or "" if idx was out of bounds
* @param idx the index of the value we want to access
**/
- const Value &getAt(uint32_t idx) const;
+ const Value &getAt(uint32_t idx) const noexcept;
};
//-----------------------------------------------------------------------------
@@ -127,7 +127,7 @@ public:
/**
* Virtual destructor to allow safe subclassing.
**/
- virtual ~IPropertiesVisitor() {}
+ virtual ~IPropertiesVisitor() = default;
};
//-----------------------------------------------------------------------------
@@ -156,7 +156,7 @@ private:
* @param buf data pointer
* @param len data length
**/
- static uint32_t rawHash(const void *buf, uint32_t len);
+ static uint32_t rawHash(const void *buf, uint32_t len) noexcept;
public:
using UP = std::unique_ptr<Properties>;
@@ -164,7 +164,7 @@ public:
/**
* Create an empty properties object.
**/
- Properties();
+ Properties() noexcept;
Properties(Properties &&) noexcept = default;
Properties & operator=(Properties &&) noexcept = default;
Properties(const Properties &);
@@ -192,7 +192,7 @@ public:
* @return number of values for the given key
* @param key the key
**/
- uint32_t count(vespalib::stringref key) const;
+ uint32_t count(vespalib::stringref key) const noexcept;
/**
* Remove all values for the given key.
@@ -226,14 +226,14 @@ public:
*
* @return number of keys
**/
- uint32_t numKeys() const { return _data.size(); }
+ uint32_t numKeys() const noexcept { return _data.size(); }
/**
* Obtain the total number of values stored in this object.
*
* @return number of values
**/
- uint32_t numValues() const { return _numValues; }
+ uint32_t numValues() const noexcept { return _numValues; }
/**
* Check if rhs contains the same key/value pairs as this
@@ -242,14 +242,14 @@ public:
*
* @return true if we are equal to rhs
**/
- bool operator==(const Properties &rhs) const;
+ bool operator==(const Properties &rhs) const noexcept;
/**
* Calculate a hash code for this object
*
* @return hash code for this object
**/
- uint32_t hashCode() const;
+ uint32_t hashCode() const noexcept;
/**
* Visit all key/value pairs
@@ -275,7 +275,7 @@ public:
* @return object encapsulating lookup result
* @param key the key to look up
**/
- Property lookup(vespalib::stringref key) const;
+ Property lookup(vespalib::stringref key) const noexcept;
/**
* Look up a key inside a namespace using the proposed namespace
@@ -289,7 +289,7 @@ public:
* @param key the key to look up
**/
Property lookup(vespalib::stringref namespace1,
- vespalib::stringref key) const;
+ vespalib::stringref key) const noexcept;
/**
* Look up a key inside a namespace using the proposed namespace
@@ -305,7 +305,7 @@ public:
**/
Property lookup(vespalib::stringref namespace1,
vespalib::stringref namespace2,
- vespalib::stringref key) const;
+ vespalib::stringref key) const noexcept;
/**
* Look up a key inside a namespace using the proposed namespace
@@ -323,13 +323,13 @@ public:
Property lookup(vespalib::stringref namespace1,
vespalib::stringref namespace2,
vespalib::stringref namespace3,
- vespalib::stringref key) const;
+ vespalib::stringref key) const noexcept;
- void swap(Properties & rhs);
+ void swap(Properties & rhs) noexcept ;
};
inline void
-swap(Properties & a, Properties & b)
+swap(Properties & a, Properties & b) noexcept
{
a.swap(b);
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
index 488c58e3119..3f6085ef7ff 100644
--- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp
@@ -87,7 +87,7 @@ Blueprint::sat_sum(const std::vector<HitEstimate> &data, uint32_t docid_limit)
return { uint32_t(std::min(sum, uint64_t(limit))), empty };
}
-Blueprint::State::State()
+Blueprint::State::State() noexcept
: _fields(),
_estimateHits(0),
_tree_size(1),
@@ -97,13 +97,13 @@ Blueprint::State::State()
_cost_tier(COST_TIER_NORMAL)
{}
-Blueprint::State::State(FieldSpecBase field)
+Blueprint::State::State(FieldSpecBase field) noexcept
: State()
{
_fields.add(field);
}
-Blueprint::State::State(FieldSpecBaseList fields_in)
+Blueprint::State::State(FieldSpecBaseList fields_in) noexcept
: _fields(std::move(fields_in)),
_estimateHits(0),
_tree_size(1),
@@ -116,7 +116,7 @@ Blueprint::State::State(FieldSpecBaseList fields_in)
Blueprint::State::~State() = default;
-Blueprint::Blueprint()
+Blueprint::Blueprint() noexcept
: _parent(0),
_sourceId(0xffffffff),
_docid_limit(0),
@@ -383,7 +383,7 @@ StateCache::notifyChange() {
IntermediateBlueprint::~IntermediateBlueprint() = default;
void
-IntermediateBlueprint::setDocIdLimit(uint32_t limit)
+IntermediateBlueprint::setDocIdLimit(uint32_t limit) noexcept
{
Blueprint::setDocIdLimit(limit);
for (Blueprint::UP &child : _children) {
@@ -576,7 +576,7 @@ IntermediateBlueprint::createSearch(fef::MatchData &md, bool strict) const
return createIntermediateSearch(std::move(subSearches), strict, md);
}
-IntermediateBlueprint::IntermediateBlueprint() = default;
+IntermediateBlueprint::IntermediateBlueprint() noexcept = default;
IntermediateBlueprint &
IntermediateBlueprint::addChild(Blueprint::UP child)
@@ -737,13 +737,6 @@ LeafBlueprint::optimize(Blueprint* &self)
}
void
-LeafBlueprint::setEstimate(HitEstimate est)
-{
- _state.estimate(est);
- notifyChange();
-}
-
-void
LeafBlueprint::set_cost_tier(uint32_t value)
{
assert(value < 0x100);
@@ -752,13 +745,6 @@ LeafBlueprint::set_cost_tier(uint32_t value)
}
void
-LeafBlueprint::set_allow_termwise_eval(bool value)
-{
- _state.allow_termwise_eval(value);
- notifyChange();
-}
-
-void
LeafBlueprint::set_want_global_filter(bool value)
{
_state.want_global_filter(value);
diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.h b/searchlib/src/vespa/searchlib/queryeval/blueprint.h
index dc7a0992d82..8d230b6ec01 100644
--- a/searchlib/src/vespa/searchlib/queryeval/blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.h
@@ -48,11 +48,11 @@ public:
uint32_t estHits;
bool empty;
- HitEstimate() : estHits(0), empty(true) {}
- HitEstimate(uint32_t estHits_, bool empty_)
+ HitEstimate() noexcept : estHits(0), empty(true) {}
+ HitEstimate(uint32_t estHits_, bool empty_) noexcept
: estHits(estHits_), empty(empty_) {}
- bool operator < (const HitEstimate &other) const {
+ bool operator < (const HitEstimate &other) const noexcept {
if (empty == other.empty) {
return (estHits < other.estHits);
} else {
@@ -77,21 +77,21 @@ public:
static constexpr uint8_t COST_TIER_EXPENSIVE = 2;
static constexpr uint8_t COST_TIER_MAX = 255;
- State();
- State(FieldSpecBase field);
- State(FieldSpecBaseList fields_in);
+ State() noexcept;
+ State(FieldSpecBase field) noexcept;
+ State(FieldSpecBaseList fields_in) noexcept;
State(const State &rhs) = delete;
State(State &&rhs) noexcept = default;
State &operator=(const State &rhs) = delete;
State &operator=(State &&rhs) noexcept = default;
~State();
- bool isTermLike() const { return !_fields.empty(); }
- const FieldSpecBaseList &fields() const { return _fields; }
+ bool isTermLike() const noexcept { return !_fields.empty(); }
+ const FieldSpecBaseList &fields() const noexcept { return _fields; }
- size_t numFields() const { return _fields.size(); }
- const FieldSpecBase &field(size_t idx) const { return _fields[idx]; }
- const FieldSpecBase *lookupField(uint32_t fieldId) const {
+ size_t numFields() const noexcept { return _fields.size(); }
+ const FieldSpecBase &field(size_t idx) const noexcept { return _fields[idx]; }
+ const FieldSpecBase *lookupField(uint32_t fieldId) const noexcept {
for (const FieldSpecBase & field : _fields) {
if (field.getFieldId() == fieldId) {
return &field;
@@ -100,27 +100,27 @@ public:
return nullptr;
}
- void estimate(HitEstimate est) {
+ void estimate(HitEstimate est) noexcept {
_estimateHits = est.estHits;
_estimateEmpty = est.empty;
}
- HitEstimate estimate() const { return HitEstimate(_estimateHits, _estimateEmpty); }
- double hit_ratio(uint32_t docid_limit) const {
+ HitEstimate estimate() const noexcept { return HitEstimate(_estimateHits, _estimateEmpty); }
+ double hit_ratio(uint32_t docid_limit) const noexcept {
uint32_t total_hits = _estimateHits;
uint32_t total_docs = std::max(total_hits, docid_limit);
return (total_docs == 0) ? 0.0 : double(total_hits) / double(total_docs);
}
- void tree_size(uint32_t value) {
+ void tree_size(uint32_t value) noexcept {
assert(value < 0x100000);
_tree_size = value;
}
- uint32_t tree_size() const { return _tree_size; }
- void allow_termwise_eval(bool value) { _allow_termwise_eval = value; }
- bool allow_termwise_eval() const { return _allow_termwise_eval; }
- void want_global_filter(bool value) { _want_global_filter = value; }
- bool want_global_filter() const { return _want_global_filter; }
- void cost_tier(uint8_t value) { _cost_tier = value; }
- uint8_t cost_tier() const { return _cost_tier; }
+ uint32_t tree_size() const noexcept { return _tree_size; }
+ void allow_termwise_eval(bool value) noexcept { _allow_termwise_eval = value; }
+ bool allow_termwise_eval() const noexcept { return _allow_termwise_eval; }
+ void want_global_filter(bool value) noexcept { _want_global_filter = value; }
+ bool want_global_filter() const noexcept { return _want_global_filter; }
+ void cost_tier(uint8_t value) noexcept { _cost_tier = value; }
+ uint8_t cost_tier() const noexcept { return _cost_tier; }
};
// utility that just takes maximum estimate
@@ -137,7 +137,7 @@ public:
// utility to get the greater estimate to sort first, higher tiers last
struct TieredGreaterEstimate {
- bool operator () (const auto &a, const auto &b) const {
+ bool operator () (const auto &a, const auto &b) const noexcept {
const auto &lhs = a->getState();
const auto &rhs = b->getState();
if (lhs.cost_tier() != rhs.cost_tier()) {
@@ -149,7 +149,7 @@ public:
// utility to get the lesser estimate to sort first, higher tiers last
struct TieredLessEstimate {
- bool operator () (const auto &a, const auto &b) const {
+ bool operator () (const auto &a, const auto &b) const noexcept {
const auto &lhs = a->getState();
const auto &rhs = b->getState();
if (lhs.cost_tier() != rhs.cost_tier()) {
@@ -189,20 +189,20 @@ public:
// hit that isn't certain to be a match).
enum class FilterConstraint { UPPER_BOUND, LOWER_BOUND };
- Blueprint();
+ Blueprint() noexcept;
Blueprint(const Blueprint &) = delete;
Blueprint &operator=(const Blueprint &) = delete;
virtual ~Blueprint();
- void setParent(Blueprint *parent) { _parent = parent; }
- Blueprint *getParent() const { return _parent; }
+ void setParent(Blueprint *parent) noexcept { _parent = parent; }
+ Blueprint *getParent() const noexcept { return _parent; }
bool has_parent() const { return (_parent != nullptr); }
- Blueprint &setSourceId(uint32_t sourceId) { _sourceId = sourceId; return *this; }
- uint32_t getSourceId() const { return _sourceId; }
+ Blueprint &setSourceId(uint32_t sourceId) noexcept { _sourceId = sourceId; return *this; }
+ uint32_t getSourceId() const noexcept { return _sourceId; }
- virtual void setDocIdLimit(uint32_t limit) { _docid_limit = limit; }
- uint32_t get_docid_limit() const { return _docid_limit; }
+ virtual void setDocIdLimit(uint32_t limit) noexcept { _docid_limit = limit; }
+ uint32_t get_docid_limit() const noexcept { return _docid_limit; }
static Blueprint::UP optimize(Blueprint::UP bp);
virtual void optimize(Blueprint* &self) = 0;
@@ -227,7 +227,7 @@ public:
virtual const State &getState() const = 0;
const Blueprint &root() const;
- double hit_ratio() const { return getState().hit_ratio(_docid_limit); }
+ double hit_ratio() const noexcept { return getState().hit_ratio(_docid_limit); }
virtual void fetchPostings(const ExecuteInfo &execInfo) = 0;
virtual void freeze() = 0;
@@ -319,10 +319,10 @@ protected:
public:
using IndexList = std::vector<size_t>;
- IntermediateBlueprint();
+ IntermediateBlueprint() noexcept;
~IntermediateBlueprint() override;
- void setDocIdLimit(uint32_t limit) final;
+ void setDocIdLimit(uint32_t limit) noexcept final;
void optimize(Blueprint* &self) final;
void set_global_filter(const GlobalFilter &global_filter, double estimated_hit_ratio) override;
@@ -360,24 +360,30 @@ private:
State _state;
protected:
void optimize(Blueprint* &self) final;
- void setEstimate(HitEstimate est);
+ void setEstimate(HitEstimate est) {
+ _state.estimate(est);
+ notifyChange();
+ }
void set_cost_tier(uint32_t value);
- void set_allow_termwise_eval(bool value);
+ void set_allow_termwise_eval(bool value) {
+ _state.allow_termwise_eval(value);
+ notifyChange();
+ }
void set_want_global_filter(bool value);
void set_tree_size(uint32_t value);
- LeafBlueprint(bool allow_termwise_eval)
+ LeafBlueprint(bool allow_termwise_eval) noexcept
: _state()
{
_state.allow_termwise_eval(allow_termwise_eval);
}
- LeafBlueprint(FieldSpecBase field, bool allow_termwise_eval)
+ LeafBlueprint(FieldSpecBase field, bool allow_termwise_eval) noexcept
: _state(field)
{
_state.allow_termwise_eval(allow_termwise_eval);
}
- LeafBlueprint(FieldSpecBaseList fields, bool allow_termwise_eval)
+ LeafBlueprint(FieldSpecBaseList fields, bool allow_termwise_eval) noexcept
: _state(std::move(fields))
{
_state.allow_termwise_eval(allow_termwise_eval);
@@ -386,7 +392,7 @@ protected:
public:
~LeafBlueprint() override = default;
const State &getState() const final { return _state; }
- void setDocIdLimit(uint32_t limit) final { Blueprint::setDocIdLimit(limit); }
+ void setDocIdLimit(uint32_t limit) noexcept final { Blueprint::setDocIdLimit(limit); }
void fetchPostings(const ExecuteInfo &execInfo) override;
void freeze() final;
SearchIteratorUP createSearch(fef::MatchData &md, bool strict) const override;
@@ -397,15 +403,15 @@ public:
// for leaf nodes representing a single term
struct SimpleLeafBlueprint : LeafBlueprint {
- explicit SimpleLeafBlueprint() : LeafBlueprint(true) {}
- explicit SimpleLeafBlueprint(FieldSpecBase field) : LeafBlueprint(field, true) {}
- explicit SimpleLeafBlueprint(FieldSpecBaseList fields) : LeafBlueprint(std::move(fields), true) {}
+ explicit SimpleLeafBlueprint() noexcept : LeafBlueprint(true) {}
+ explicit SimpleLeafBlueprint(FieldSpecBase field) noexcept : LeafBlueprint(field, true) {}
+ explicit SimpleLeafBlueprint(FieldSpecBaseList fields) noexcept: LeafBlueprint(std::move(fields), true) {}
};
// for leaf nodes representing more complex structures like wand/phrase
struct ComplexLeafBlueprint : LeafBlueprint {
- explicit ComplexLeafBlueprint(FieldSpecBase field) : LeafBlueprint(field, false) {}
- explicit ComplexLeafBlueprint(FieldSpecBaseList fields) : LeafBlueprint(std::move(fields), false) {}
+ explicit ComplexLeafBlueprint(FieldSpecBase field) noexcept : LeafBlueprint(field, false) {}
+ explicit ComplexLeafBlueprint(FieldSpecBaseList fields) noexcept : LeafBlueprint(std::move(fields), false) {}
};
//-----------------------------------------------------------------------------
diff --git a/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp b/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp
index 121591723e2..cd1ddd5b92e 100644
--- a/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/field_spec.cpp
@@ -5,9 +5,9 @@
namespace search::queryeval {
-FieldSpecBase::FieldSpecBase(uint32_t fieldId, fef::TermFieldHandle handle, bool isFilter_) :
- _fieldId(fieldId | (isFilter_ ? 0x1000000u : 0)),
- _handle(handle)
+FieldSpecBase::FieldSpecBase(uint32_t fieldId, fef::TermFieldHandle handle, bool isFilter_) noexcept
+ : _fieldId(fieldId | (isFilter_ ? 0x1000000u : 0)),
+ _handle(handle)
{
assert(fieldId < 0x1000000); // Can be represented by 24 bits
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/field_spec.h b/searchlib/src/vespa/searchlib/queryeval/field_spec.h
index 3fe43597602..960afb95281 100644
--- a/searchlib/src/vespa/searchlib/queryeval/field_spec.h
+++ b/searchlib/src/vespa/searchlib/queryeval/field_spec.h
@@ -19,15 +19,15 @@ namespace search::queryeval {
class FieldSpecBase
{
public:
- FieldSpecBase(uint32_t fieldId, fef::TermFieldHandle handle, bool isFilter_ = false);
+ FieldSpecBase(uint32_t fieldId, fef::TermFieldHandle handle, bool isFilter_ = false) noexcept;
// resolve where to put match information for this term/field combination
fef::TermFieldMatchData *resolve(fef::MatchData &md) const;
const fef::TermFieldMatchData *resolve(const fef::MatchData &md) const;
- uint32_t getFieldId() const { return _fieldId & 0xffffff; }
- fef::TermFieldHandle getHandle() const { return _handle; }
+ uint32_t getFieldId() const noexcept { return _fieldId & 0xffffff; }
+ fef::TermFieldHandle getHandle() const noexcept { return _handle; }
/// a filter produces less detailed match data
- bool isFilter() const { return _fieldId & 0x1000000; }
+ bool isFilter() const noexcept { return _fieldId & 0x1000000; }
private:
uint32_t _fieldId; // field id in ranking framework
fef::TermFieldHandle _handle; // handle used when exposing match data to ranking framework
@@ -40,18 +40,18 @@ class FieldSpec : public FieldSpecBase
{
public:
FieldSpec(const vespalib::string & name, uint32_t fieldId,
- fef::TermFieldHandle handle, bool isFilter_ = false)
+ fef::TermFieldHandle handle, bool isFilter_ = false) noexcept
: FieldSpecBase(fieldId, handle, isFilter_),
_name(name)
{}
- FieldSpec(const vespalib::string & name, FieldSpecBase base)
+ FieldSpec(const vespalib::string & name, FieldSpecBase base) noexcept
: FieldSpecBase(base),
_name(name)
{}
~FieldSpec();
- void setBase(FieldSpecBase base) {
- static_cast<FieldSpecBase &>(*this) = base;
+ void setBase(FieldSpecBase base) noexcept {
+ FieldSpecBase::operator =(base);
}
const vespalib::string & getName() const noexcept { return _name; }
private:
@@ -68,7 +68,7 @@ private:
List _list;
public:
- FieldSpecBaseList() = default;
+ FieldSpecBaseList() noexcept = default;
FieldSpecBaseList(FieldSpecBaseList &&) noexcept = default;
FieldSpecBaseList & operator=(FieldSpecBaseList &&) noexcept = default;
FieldSpecBaseList(const FieldSpecBaseList &) = default;
@@ -76,15 +76,15 @@ public:
~FieldSpecBaseList();
void reserve(size_t sz) { _list.reserve(sz); }
using const_iterator = const FieldSpecBase *;
- FieldSpecBaseList &add(const FieldSpecBase &spec) {
+ FieldSpecBaseList &add(const FieldSpecBase &spec) noexcept {
_list.push_back(spec);
return *this;
}
- bool empty() const { return _list.empty(); }
- size_t size() const { return _list.size(); }
- const_iterator begin() const { return _list.begin(); }
- const_iterator end() const { return _list.end(); }
- const FieldSpecBase &operator[](size_t i) const { return _list[i]; }
+ bool empty() const noexcept { return _list.empty(); }
+ size_t size() const noexcept { return _list.size(); }
+ const_iterator begin() const noexcept { return _list.begin(); }
+ const_iterator end() const noexcept { return _list.end(); }
+ const FieldSpecBase &operator[](size_t i) const noexcept { return _list[i]; }
};
/**
@@ -96,7 +96,7 @@ private:
vespalib::SmallVector<FieldSpec, 1> _list;
public:
- FieldSpecList() = default;
+ FieldSpecList() noexcept = default;
FieldSpecList(FieldSpecList &&) noexcept = delete;
FieldSpecList & operator=(FieldSpecList &&) noexcept = delete;
FieldSpecList(const FieldSpecList &) noexcept = delete;
@@ -106,9 +106,9 @@ public:
_list.push_back(spec);
return *this;
}
- bool empty() const { return _list.empty(); }
- size_t size() const { return _list.size(); }
- const FieldSpec &operator[](size_t i) const { return _list[i]; }
+ bool empty() const noexcept { return _list.empty(); }
+ size_t size() const noexcept { return _list.size(); }
+ const FieldSpec &operator[](size_t i) const noexcept { return _list[i]; }
void clear() { _list.clear(); }
};