summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-12-13 11:32:29 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-12-13 11:32:29 +0000
commitbd8012c7826efe15bfad0ed395bd76d678e76605 (patch)
treedd2d31503e1b463003179fd9d59eb6cd4beb706d /searchlib
parent32b8a74701ade63457977a36aaa56cdcc5ddaf0a (diff)
- Add some more extern templates to enable code to build with -O0.
- Add some more noexcept.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp1
-rw-r--r--searchlib/src/tests/attribute/sort_blob_writers/sort_blob_writers_test.cpp9
-rw-r--r--searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumcomparator.h30
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringpostattribute.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h94
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp95
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlestringattribute.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/util/foldedstringcompare.h10
13 files changed, 136 insertions, 140 deletions
diff --git a/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp b/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp
index f90f802e84e..433ad9e7671 100644
--- a/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp
+++ b/searchlib/src/tests/attribute/dfa_fuzzy_matcher/dfa_fuzzy_matcher_test.cpp
@@ -3,7 +3,6 @@
#include <vespa/searchcommon/common/dictionary_config.h>
#include <vespa/searchlib/attribute/dfa_fuzzy_matcher.h>
#include <vespa/searchlib/attribute/enumstore.h>
-#include <vespa/searchlib/attribute/i_enum_store_dictionary.h>
#include <vespa/vespalib/fuzzy/fuzzy_matcher.h>
#include <vespa/vespalib/fuzzy/levenshtein_dfa.h>
#include <vespa/vespalib/gtest/gtest.h>
diff --git a/searchlib/src/tests/attribute/sort_blob_writers/sort_blob_writers_test.cpp b/searchlib/src/tests/attribute/sort_blob_writers/sort_blob_writers_test.cpp
index c44de761785..a4f1a4bddd8 100644
--- a/searchlib/src/tests/attribute/sort_blob_writers/sort_blob_writers_test.cpp
+++ b/searchlib/src/tests/attribute/sort_blob_writers/sort_blob_writers_test.cpp
@@ -122,11 +122,12 @@ sort_data(std::vector<T> values, bool asc)
{
if constexpr (std::is_same_v<T, const char*>) {
return sort_data_string(values, asc);
+ } else {
+ if (asc) {
+ return sort_data_numeric<T, true>(std::move(values));
+ }
+ return sort_data_numeric<T, false>(std::move(values));
}
- if (asc) {
- return sort_data_numeric<T, true>(std::move(values));
- }
- return sort_data_numeric<T, false>(std::move(values));
}
SortData
diff --git a/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.cpp b/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.cpp
index 9204510c0d2..4ee717b49c2 100644
--- a/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.cpp
@@ -5,7 +5,7 @@
namespace search::attribute {
-DfaStringComparator::DfaStringComparator(const DataStoreType& data_store, const std::vector<uint32_t>& candidate, bool cased)
+DfaStringComparator::DfaStringComparator(const DataStoreType& data_store, const std::vector<uint32_t>& candidate, bool cased) noexcept
: ParentType(data_store),
_candidate(std::cref(candidate)),
_cased(cased)
@@ -13,7 +13,7 @@ DfaStringComparator::DfaStringComparator(const DataStoreType& data_store, const
}
bool
-DfaStringComparator::less(const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const
+DfaStringComparator::less(const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const noexcept
{
if (lhs.valid()) {
if (rhs.valid()) {
diff --git a/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.h b/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.h
index 13a337f565c..76e96ddd6cf 100644
--- a/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.h
+++ b/searchlib/src/vespa/searchlib/attribute/dfa_string_comparator.h
@@ -29,9 +29,9 @@ private:
bool _cased;
public:
- DfaStringComparator(const DataStoreType& data_store, const std::vector<uint32_t>& candidate, bool cased);
+ DfaStringComparator(const DataStoreType& data_store, const std::vector<uint32_t>& candidate, bool cased) noexcept;
- bool less(const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const override;
+ bool less(const vespalib::datastore::EntryRef lhs, const vespalib::datastore::EntryRef rhs) const noexcept override;
};
}
diff --git a/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp b/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp
index 6cb805d701b..eb19807e1b7 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumcomparator.cpp
@@ -7,12 +7,12 @@ namespace search {
template <typename EntryT>
bool
-EnumStoreComparator<EntryT>::equal_helper(const EntryT& lhs, const EntryT& rhs)
+EnumStoreComparator<EntryT>::equal_helper(const EntryT& lhs, const EntryT& rhs) noexcept
{
return vespalib::datastore::UniqueStoreComparatorHelper<EntryT>::equal(lhs, rhs);
}
-EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy)
+EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy) noexcept
: ParentType(data_store, nullptr),
_compare_strategy(compare_strategy),
_prefix(false),
@@ -20,7 +20,7 @@ EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_s
{
}
-EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value)
+EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value) noexcept
: ParentType(data_store, lookup_value),
_compare_strategy(compare_strategy),
_prefix(false),
@@ -28,7 +28,7 @@ EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_s
{
}
-EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value, bool prefix)
+EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value, bool prefix) noexcept
: ParentType(data_store, lookup_value),
_compare_strategy(compare_strategy),
_prefix(prefix),
@@ -40,7 +40,7 @@ EnumStoreStringComparator::EnumStoreStringComparator(const DataStoreType& data_s
}
bool
-EnumStoreStringComparator::less(vespalib::datastore::EntryRef lhs, vespalib::datastore::EntryRef rhs) const {
+EnumStoreStringComparator::less(vespalib::datastore::EntryRef lhs, vespalib::datastore::EntryRef rhs) const noexcept {
switch (_compare_strategy) {
case CompareStrategy::UNCASED:
return (use_prefix()
diff --git a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
index 59dbb3a8cc3..33b0f82d006 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumcomparator.h
@@ -18,22 +18,22 @@ public:
using ParentType = vespalib::datastore::UniqueStoreComparator<EntryT, IEnumStore::InternalIndex>;
using DataStoreType = typename ParentType::DataStoreType;
- explicit EnumStoreComparator(const DataStoreType& data_store)
+ explicit EnumStoreComparator(const DataStoreType& data_store) noexcept
: ParentType(data_store)
{}
private:
- EnumStoreComparator(const DataStoreType& data_store, const EntryT& lookup_value)
+ EnumStoreComparator(const DataStoreType& data_store, const EntryT& lookup_value) noexcept
: ParentType(data_store, lookup_value)
{}
public:
- static bool equal_helper(const EntryT& lhs, const EntryT& rhs);
+ static bool equal_helper(const EntryT& lhs, const EntryT& rhs) noexcept;
- EnumStoreComparator<EntryT> make_folded() const {
+ EnumStoreComparator<EntryT> make_folded() const noexcept {
return *this;
}
- EnumStoreComparator<EntryT> make_for_lookup(const EntryT& lookup_value) const {
+ EnumStoreComparator<EntryT> make_for_lookup(const EntryT& lookup_value) const noexcept {
return {this->_store, lookup_value};
}
};
@@ -76,36 +76,36 @@ private:
};
public:
- explicit EnumStoreStringComparator(const DataStoreType& data_store)
+ explicit EnumStoreStringComparator(const DataStoreType& data_store) noexcept
: EnumStoreStringComparator(data_store, CompareStrategy::UNCASED_THEN_CASED)
{}
- EnumStoreStringComparator(const DataStoreType& data_store, bool cased)
+ EnumStoreStringComparator(const DataStoreType& data_store, bool cased) noexcept
: EnumStoreStringComparator(data_store, cased ? CompareStrategy::CASED : CompareStrategy::UNCASED_THEN_CASED)
{}
private:
- EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy);
+ EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy) noexcept;
/**
* Creates a comparator using the given low-level data store and that uses the
* given value during compare if the enum index is invalid.
*/
- EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value);
- EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value, bool prefix);
+ EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value) noexcept;
+ EnumStoreStringComparator(const DataStoreType& data_store, CompareStrategy compare_strategy, const char* lookup_value, bool prefix) noexcept;
public:
- bool less(vespalib::datastore::EntryRef lhs, vespalib::datastore::EntryRef rhs) const override;
- EnumStoreStringComparator make_folded() const {
+ bool less(vespalib::datastore::EntryRef lhs, vespalib::datastore::EntryRef rhs) const noexcept override;
+ EnumStoreStringComparator make_folded() const noexcept {
return {_store, _compare_strategy == CompareStrategy::UNCASED_THEN_CASED ? CompareStrategy::UNCASED : _compare_strategy};
}
- EnumStoreStringComparator make_for_lookup(const char* lookup_value) const {
+ EnumStoreStringComparator make_for_lookup(const char* lookup_value) const noexcept {
return {_store, _compare_strategy, lookup_value};
}
- EnumStoreStringComparator make_for_prefix_lookup(const char* lookup_value) const {
+ EnumStoreStringComparator make_for_prefix_lookup(const char* lookup_value) const noexcept {
return {_store, _compare_strategy, lookup_value, true};
}
private:
- inline bool use_prefix() const noexcept { return _prefix; }
+ bool use_prefix() const noexcept { return _prefix; }
const CompareStrategy _compare_strategy;
const bool _prefix;
uint32_t _prefix_len;
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.cpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.cpp
index 6f0daaf8838..6e2943dc0ae 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.cpp
@@ -1,9 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "multistringpostattribute.hpp"
-
-#include <vespa/log/log.h>
-LOG_SETUP(".searchlib.attribute.multi_string_post_attribute");
+#include "postinglistsearchcontext.hpp"
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
index a291318e837..276e5b7859b 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h
@@ -255,100 +255,6 @@ PostingSearchContext(BaseSC&& base_sc, bool useBitVector, const AttrT &toBeSearc
template <typename BaseSC, typename BaseSC2, typename AttrT>
PostingSearchContext<BaseSC, BaseSC2, AttrT>::~PostingSearchContext() = default;
-
-template <typename BaseSC, typename AttrT, typename DataT>
-StringPostingSearchContext<BaseSC, AttrT, DataT>::
-StringPostingSearchContext(BaseSC&& base_sc, bool useBitVector, const AttrT &toBeSearched)
- : Parent(std::move(base_sc), useBitVector, toBeSearched)
-{
- if (this->valid()) {
- if (this->isPrefix()) {
- auto comp = _enumStore.make_folded_comparator_prefix(this->queryTerm()->getTerm());
- this->lookupRange(comp, comp);
- } else if (this->isRegex()) {
- vespalib::string prefix(RegexpUtil::get_prefix(this->queryTerm()->getTerm()));
- auto comp = _enumStore.make_folded_comparator_prefix(prefix.c_str());
- this->lookupRange(comp, comp);
- } else if (this->isFuzzy()) {
- vespalib::string prefix(this->getFuzzyMatcher().getPrefix());
- auto comp = _enumStore.make_folded_comparator_prefix(prefix.c_str());
- this->lookupRange(comp, comp);
- } else {
- auto comp = _enumStore.make_folded_comparator(this->queryTerm()->getTerm());
- this->lookupTerm(comp);
- }
- if (this->_uniqueValues == 1u) {
- /*
- * A single dictionary entry from lookupRange() might not be
- * a match if this is a regex search or a fuzzy search.
- */
- if (!this->_lowerDictItr.valid() || use_single_dictionary_entry(this->_lowerDictItr)) {
- this->lookupSingle();
- } else {
- this->_uniqueValues = 0;
- }
- }
- }
-}
-
-template <typename BaseSC, typename AttrT, typename DataT>
-bool
-StringPostingSearchContext<BaseSC, AttrT, DataT>::use_dictionary_entry(PostingListSearchContext::DictionaryConstIterator& it) const {
- if ( this->isRegex() ) {
- if (this->getRegex().valid() &&
- this->getRegex().partial_match(_enumStore.get_value(it.getKey().load_acquire()))) {
- return true;
- }
- ++it;
- return false;
- } else if ( this->isCased() ) {
- if (this->match(_enumStore.get_value(it.getKey().load_acquire()))) {
- return true;
- }
- ++it;
- return false;
- } else if (this->isFuzzy()) {
- return this->is_fuzzy_match(_enumStore.get_value(it.getKey().load_acquire()), it, _enumStore.get_data_store());
- }
- return true;
-}
-
-template <typename BaseSC, typename AttrT, typename DataT>
-bool
-StringPostingSearchContext<BaseSC, AttrT, DataT>::use_posting_lists_when_non_strict(const queryeval::ExecuteInfo& info) const
-{
- if (this->isFuzzy()) {
- uint32_t exp_doc_hits = this->_docIdLimit * info.hit_rate();
- constexpr uint32_t fuzzy_use_posting_lists_doc_limit = 10000;
- /**
- * The above constant was derived after a query latency experiment with fuzzy matching
- * on 2M documents with a dictionary size of 292070.
- *
- * Cost per document in dfa-based fuzzy matching (scanning the dictionary and merging posting lists) - strict iterator:
- * 2.8 ms / 2k = 0.0014 ms
- * 4.4 ms / 20k = 0.00022 ms
- * 9.0 ms / 200k = 0.000045 ms
- * 98 ms / 1M = 0.000098 ms
- *
- * Cost per document in lookup-based fuzzy matching - non-strict iterator:
- * 7.6 ms / 2k = 0.0038 ms
- * 54 ms / 20k = 0.0027 ms
- * 529 ms / 200k = 0.0026 ms
- *
- * Based on this experiment, we observe that we should avoid lookup-based fuzzy matching
- * when the number of documents to calculate this on exceeds a number between 2000 - 20000.
- *
- * Also note that the cost of scanning the dictionary and performing the fuzzy matching
- * is already performed at this point.
- * The only work remaining if returning true is merging the posting lists.
- */
- if (exp_doc_hits > fuzzy_use_posting_lists_doc_limit) {
- return true;
- }
- }
- return false;
-}
-
template <typename BaseSC, typename AttrT, typename DataT>
NumericPostingSearchContext<BaseSC, AttrT, DataT>::
NumericPostingSearchContext(BaseSC&& base_sc, const Params & params_in, const AttrT &toBeSearched)
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
index ecdfad433ee..b794721f8b6 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp
@@ -31,7 +31,6 @@ PostingListSearchContextT(const IEnumStoreDictionary& dictionary, uint32_t docId
template <typename DataT>
PostingListSearchContextT<DataT>::~PostingListSearchContextT() = default;
-
template <typename DataT>
void
PostingListSearchContextT<DataT>::lookupSingle()
@@ -372,4 +371,98 @@ PostingListFoldedSearchContextT<DataT>::fillBitVector()
fill_array_or_bitvector<false>();
}
+
+template <typename BaseSC, typename AttrT, typename DataT>
+StringPostingSearchContext<BaseSC, AttrT, DataT>::
+StringPostingSearchContext(BaseSC&& base_sc, bool useBitVector, const AttrT &toBeSearched)
+ : Parent(std::move(base_sc), useBitVector, toBeSearched)
+{
+ if (this->valid()) {
+ if (this->isPrefix()) {
+ auto comp = _enumStore.make_folded_comparator_prefix(this->queryTerm()->getTerm());
+ this->lookupRange(comp, comp);
+ } else if (this->isRegex()) {
+ vespalib::string prefix(RegexpUtil::get_prefix(this->queryTerm()->getTerm()));
+ auto comp = _enumStore.make_folded_comparator_prefix(prefix.c_str());
+ this->lookupRange(comp, comp);
+ } else if (this->isFuzzy()) {
+ vespalib::string prefix(this->getFuzzyMatcher().getPrefix());
+ auto comp = _enumStore.make_folded_comparator_prefix(prefix.c_str());
+ this->lookupRange(comp, comp);
+ } else {
+ auto comp = _enumStore.make_folded_comparator(this->queryTerm()->getTerm());
+ this->lookupTerm(comp);
+ }
+ if (this->_uniqueValues == 1u) {
+ /*
+ * A single dictionary entry from lookupRange() might not be
+ * a match if this is a regex search or a fuzzy search.
+ */
+ if (!this->_lowerDictItr.valid() || use_single_dictionary_entry(this->_lowerDictItr)) {
+ this->lookupSingle();
+ } else {
+ this->_uniqueValues = 0;
+ }
+ }
+ }
+}
+
+template <typename BaseSC, typename AttrT, typename DataT>
+bool
+StringPostingSearchContext<BaseSC, AttrT, DataT>::use_dictionary_entry(PostingListSearchContext::DictionaryConstIterator& it) const {
+ if ( this->isRegex() ) {
+ if (this->getRegex().valid() &&
+ this->getRegex().partial_match(_enumStore.get_value(it.getKey().load_acquire()))) {
+ return true;
+ }
+ ++it;
+ return false;
+ } else if ( this->isCased() ) {
+ if (this->match(_enumStore.get_value(it.getKey().load_acquire()))) {
+ return true;
+ }
+ ++it;
+ return false;
+ } else if (this->isFuzzy()) {
+ return this->is_fuzzy_match(_enumStore.get_value(it.getKey().load_acquire()), it, _enumStore.get_data_store());
+ }
+ return true;
+}
+
+template <typename BaseSC, typename AttrT, typename DataT>
+bool
+StringPostingSearchContext<BaseSC, AttrT, DataT>::use_posting_lists_when_non_strict(const queryeval::ExecuteInfo& info) const
+{
+ if (this->isFuzzy()) {
+ uint32_t exp_doc_hits = this->_docIdLimit * info.hit_rate();
+ constexpr uint32_t fuzzy_use_posting_lists_doc_limit = 10000;
+ /**
+ * The above constant was derived after a query latency experiment with fuzzy matching
+ * on 2M documents with a dictionary size of 292070.
+ *
+ * Cost per document in dfa-based fuzzy matching (scanning the dictionary and merging posting lists) - strict iterator:
+ * 2.8 ms / 2k = 0.0014 ms
+ * 4.4 ms / 20k = 0.00022 ms
+ * 9.0 ms / 200k = 0.000045 ms
+ * 98 ms / 1M = 0.000098 ms
+ *
+ * Cost per document in lookup-based fuzzy matching - non-strict iterator:
+ * 7.6 ms / 2k = 0.0038 ms
+ * 54 ms / 20k = 0.0027 ms
+ * 529 ms / 200k = 0.0026 ms
+ *
+ * Based on this experiment, we observe that we should avoid lookup-based fuzzy matching
+ * when the number of documents to calculate this on exceeds a number between 2000 - 20000.
+ *
+ * Also note that the cost of scanning the dictionary and performing the fuzzy matching
+ * is already performed at this point.
+ * The only work remaining if returning true is merging the posting lists.
+ */
+ if (exp_doc_hits > fuzzy_use_posting_lists_doc_limit) {
+ return true;
+ }
+ }
+ return false;
+}
+
}
diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.cpp
index 60b696bb78a..e0cd39270ae 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlestringattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlestringattribute.cpp
@@ -2,9 +2,6 @@
#include "singlestringattribute.hpp"
-#include <vespa/log/log.h>
-LOG_SETUP(".searchlib.attribute.single_string_attribute");
-
namespace search {
template class SingleValueStringAttributeT<EnumAttribute<StringAttribute>>;
diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.cpp b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.cpp
index a11ccf4ded3..ecb6626e119 100644
--- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.cpp
@@ -1,6 +1,8 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "singlestringpostattribute.hpp"
+#include "postinglistsearchcontext.hpp"
+
namespace search {
diff --git a/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp b/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp
index 2a8c7134e15..a8074f22774 100644
--- a/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp
+++ b/searchlib/src/vespa/searchlib/util/foldedstringcompare.cpp
@@ -49,7 +49,7 @@ using Reader = typename foldedstringcompare::FoldableStringHelper<KeyType>::Read
size_t
FoldedStringCompare::
-size(const char *key)
+size(const char *key) noexcept
{
return Utf8ReaderForZTS::countChars(key);
}
@@ -57,7 +57,7 @@ size(const char *key)
template <bool fold_lhs, bool fold_rhs, detail::FoldableString KeyType, detail::FoldableString OKeyType>
int
FoldedStringCompare::
-compareFolded(KeyType key, OKeyType okey)
+compareFolded(KeyType key, OKeyType okey) noexcept
{
Reader<KeyType> kreader(key);
Reader<OKeyType> oreader(okey);
@@ -84,7 +84,7 @@ compareFolded(KeyType key, OKeyType okey)
template <bool fold_lhs, bool fold_rhs>
int
FoldedStringCompare::
-compareFoldedPrefix(const char *key, const char *okey, size_t prefixLen)
+compareFoldedPrefix(const char *key, const char *okey, size_t prefixLen) noexcept
{
Utf8ReaderForZTS kreader(key);
Utf8ReaderForZTS oreader(okey);
@@ -110,7 +110,7 @@ compareFoldedPrefix(const char *key, const char *okey, size_t prefixLen)
int
FoldedStringCompare::
-comparePrefix(const char *key, const char *okey, size_t prefixLen)
+comparePrefix(const char *key, const char *okey, size_t prefixLen) noexcept
{
int res = compareFoldedPrefix<true, true>(key, okey, prefixLen);
if (res != 0) {
@@ -122,7 +122,7 @@ comparePrefix(const char *key, const char *okey, size_t prefixLen)
int
FoldedStringCompare::
-compare(const char *key, const char *okey)
+compare(const char *key, const char *okey) noexcept
{
int res = compareFolded<true, true>(key, okey);
if (res != 0) {
diff --git a/searchlib/src/vespa/searchlib/util/foldedstringcompare.h b/searchlib/src/vespa/searchlib/util/foldedstringcompare.h
index ae54e35672b..ab3458dae52 100644
--- a/searchlib/src/vespa/searchlib/util/foldedstringcompare.h
+++ b/searchlib/src/vespa/searchlib/util/foldedstringcompare.h
@@ -25,7 +25,7 @@ public:
* @param key NUL terminated UTF-8 string
* @return integer number of symbols in UTF-8 string before NUL
*/
- static size_t size(const char *key);
+ static size_t size(const char *key) noexcept;
/**
* Compare UTF-8 key with UTF-8 other key after folding both
@@ -35,7 +35,7 @@ public:
* @return integer -1 if key < okey, 0 if key == okey, 1 if key > okey
**/
template <bool fold_lhs, bool fold_rhs, detail::FoldableString KeyType, detail::FoldableString OKeyType>
- static int compareFolded(KeyType key, OKeyType okey);
+ static int compareFolded(KeyType key, OKeyType okey) noexcept;
/**
* Compare UTF-8 key with UTF-8 other key after folding both.
@@ -48,7 +48,7 @@ public:
* @return integer -1 if key < okey, 0 if key == okey, 1 if key > okey
*/
template <bool fold_lhs, bool fold_rhs>
- static int compareFoldedPrefix(const char *key, const char *okey, size_t prefixLen);
+ static int compareFoldedPrefix(const char *key, const char *okey, size_t prefixLen) noexcept;
/*
* Compare UTF-8 key with UTF-8 other key after folding both, if
@@ -58,7 +58,7 @@ public:
* @param okey NUL terminated UTF-8 string
* @return integer -1 if key < okey, 0 if key == okey, 1 if key > okey
*/
- static int compare(const char *key, const char *okey);
+ static int compare(const char *key, const char *okey) noexcept;
/*
* Compare UTF-8 key with UTF-8 other key after folding both for prefix, if
@@ -70,7 +70,7 @@ public:
* considering keys identical.
* @return integer -1 if key < okey, 0 if key == okey, 1 if key > okey
*/
- static int comparePrefix(const char *key, const char *okey, size_t prefixLen);
+ static int comparePrefix(const char *key, const char *okey, size_t prefixLen) noexcept;
};
} // namespace search