summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp10
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.h14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreeiterator.hpp12
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenode.h2
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreenodeallocator.h14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreerootbase.cpp14
-rw-r--r--vespalib/src/vespa/vespalib/btree/btreerootbase.h14
-rw-r--r--vespalib/src/vespa/vespalib/datastore/entry_comparator.h8
-rw-r--r--vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h4
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store.hpp2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h26
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h10
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h10
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h14
-rw-r--r--vespalib/src/vespa/vespalib/text/utf8.h2
31 files changed, 217 insertions, 234 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
diff --git a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
index e162d69529f..9dea9848d3a 100644
--- a/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store_dictionary/unique_store_dictionary_test.cpp
@@ -16,7 +16,7 @@ class Comparator : public EntryComparator {
private:
EntryRef _to_find;
- EntryRef resolve(EntryRef ref) const {
+ EntryRef resolve(EntryRef ref) const noexcept {
if (ref == EntryRef()) {
return _to_find;
}
@@ -24,16 +24,16 @@ private:
}
public:
- explicit Comparator(uint32_t to_find)
+ explicit Comparator(uint32_t to_find) noexcept
: _to_find(to_find)
{}
- bool less(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const noexcept override {
return resolve(lhs).ref() < resolve(rhs).ref();
}
- bool equal(const EntryRef lhs, const EntryRef rhs) const override {
+ bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept override {
return resolve(lhs).ref() == resolve(rhs).ref();
}
- size_t hash(const EntryRef rhs) const override {
+ size_t hash(const EntryRef rhs) const noexcept override {
return rhs.valid() ? rhs.ref() : _to_find.ref();
}
};
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
index 28c76a317e0..a03d9358069 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.cpp
@@ -8,9 +8,12 @@ namespace vespalib::btree {
template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>;
template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>;
template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>;
+template class BTreeIteratorBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated>;
+template class BTreeIteratorBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated>;
template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>;
template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
template class BTreeConstIterator<uint32_t, int32_t, MinMaxAggregated>;
+template class BTreeConstIterator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, const datastore::EntryComparatorWrapper>;
template class BTreeIterator<uint32_t, uint32_t, NoAggregated>;
template class BTreeIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
template class BTreeIterator<uint32_t, int32_t, MinMaxAggregated>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.h b/vespalib/src/vespa/vespalib/btree/btreeiterator.h
index cd63499a5ed..eae88c6e4be 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.h
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.h
@@ -5,6 +5,7 @@
#include "btreenode.h"
#include "btreenodeallocator.h"
#include "btreetraits.h"
+#include <vespa/vespalib/datastore/entry_comparator_wrapper.h>
#include <cassert>
namespace vespalib::btree {
@@ -255,7 +256,7 @@ protected:
*
* @param pathSize New tree height (number of levels of internal nodes)
*/
- VESPA_DLL_LOCAL void clearPath(uint32_t pathSize);
+ void clearPath(uint32_t pathSize);
/**
* Call func with leaf entry key value as argument for all leaf entries in subtree
@@ -327,7 +328,7 @@ public:
*/
const KeyType & getKey() const noexcept { return _leaf.getKey(); }
- /**
+ /**stringatt
* Get data at current iterator location.
*/
const DataType & getData() const noexcept { return _leaf.getData(); }
@@ -366,7 +367,11 @@ public:
/**
* Setup iterator to be empty and not be associated with any tree.
*/
- VESPA_DLL_LOCAL void setupEmpty();
+ void setupEmpty() {
+ clearPath(0u);
+ _leaf.invalidate();
+ _leafRoot = nullptr;
+ }
/**
* Move iterator to beyond last element in the current tree.
@@ -845,10 +850,13 @@ private:
extern template class BTreeIteratorBase<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeIteratorBase<uint32_t, BTreeNoLeafData, NoAggregated>;
+extern template class BTreeIteratorBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated>;
+extern template class BTreeIteratorBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated>;
extern template class BTreeIteratorBase<uint32_t, int32_t, MinMaxAggregated>;
extern template class BTreeConstIterator<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeConstIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
extern template class BTreeConstIterator<uint32_t, int32_t, MinMaxAggregated>;
+extern template class BTreeConstIterator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, const datastore::EntryComparatorWrapper>;
extern template class BTreeIterator<uint32_t, uint32_t, NoAggregated>;
extern template class BTreeIterator<uint32_t, BTreeNoLeafData, NoAggregated>;
extern template class BTreeIterator<uint32_t, int32_t, MinMaxAggregated>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp b/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
index b9afce54f6b..bdca5e2c4ff 100644
--- a/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
+++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.hpp
@@ -95,18 +95,6 @@ template <typename KeyT, typename DataT, typename AggrT,
uint32_t INTERNAL_SLOTS, uint32_t LEAF_SLOTS, uint32_t PATH_SIZE>
void
BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>::
-setupEmpty()
-{
- clearPath(0u);
- _leaf.invalidate();
- _leafRoot = nullptr;
-}
-
-
-template <typename KeyT, typename DataT, typename AggrT,
- uint32_t INTERNAL_SLOTS, uint32_t LEAF_SLOTS, uint32_t PATH_SIZE>
-void
-BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>::
end()
{
if (_pathSize == 0) {
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.cpp b/vespalib/src/vespa/vespalib/btree/btreenode.cpp
index 246eba8917b..6f858c40a66 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.cpp
@@ -14,9 +14,11 @@ template class BTreeNodeDataWrap<BTreeNoLeafData, 16>;
template class BTreeNodeT<uint32_t, 16>;
template class BTreeNodeTT<uint32_t, uint32_t, NoAggregated, 16>;
template class BTreeNodeTT<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
+template class BTreeNodeTT<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, 16>;
template class BTreeNodeTT<uint32_t, datastore::EntryRef, NoAggregated, 16>;
template class BTreeNodeTT<uint32_t, int32_t, MinMaxAggregated, 16>;
template class BTreeInternalNode<uint32_t, NoAggregated, 16>;
+template class BTreeInternalNode<datastore::AtomicEntryRef, NoAggregated, 16>;
template class BTreeInternalNode<uint32_t, MinMaxAggregated, 16>;
template class BTreeLeafNode<uint32_t, uint32_t, NoAggregated, 16>;
template class BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.h b/vespalib/src/vespa/vespalib/btree/btreenode.h
index 7a4fa8030d3..075bae64834 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenode.h
+++ b/vespalib/src/vespa/vespalib/btree/btreenode.h
@@ -488,9 +488,11 @@ extern template class BTreeNodeDataWrap<BTreeNoLeafData, 16>;
extern template class BTreeNodeT<uint32_t, 16>;
extern template class BTreeNodeTT<uint32_t, uint32_t, NoAggregated, 16>;
extern template class BTreeNodeTT<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
+extern template class BTreeNodeTT<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, 16>;
extern template class BTreeNodeTT<uint32_t, datastore::EntryRef, NoAggregated, 16>;
extern template class BTreeNodeTT<uint32_t, int32_t, MinMaxAggregated, 16>;
extern template class BTreeInternalNode<uint32_t, NoAggregated, 16>;
+extern template class BTreeInternalNode<datastore::AtomicEntryRef, NoAggregated, 16>;
extern template class BTreeInternalNode<uint32_t, MinMaxAggregated, 16>;
extern template class BTreeLeafNode<uint32_t, uint32_t, NoAggregated, 16>;
extern template class BTreeLeafNode<uint32_t, BTreeNoLeafData, NoAggregated, 16>;
diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp
index 99faaa6e2e8..fa51a38ab9a 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.cpp
@@ -7,14 +7,10 @@ template class vespalib::Array<vespalib::datastore::EntryRef>;
namespace vespalib::btree {
-template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeNodeAllocator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h
index 16bd46a5596..e36d1507495 100644
--- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h
+++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h
@@ -178,15 +178,11 @@ public:
const NodeStore &getNodeStore() const { return _nodeStore; }
};
-extern template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeNodeAllocator<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp b/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp
index b6eb589ea4a..48f4754ec4c 100644
--- a/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp
+++ b/vespalib/src/vespa/vespalib/btree/btreerootbase.cpp
@@ -4,14 +4,10 @@
namespace vespalib::btree {
-template class BTreeRootBase<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+template class BTreeRootBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/btree/btreerootbase.h b/vespalib/src/vespa/vespalib/btree/btreerootbase.h
index 108cb2412a1..fa179dc8730 100644
--- a/vespalib/src/vespa/vespalib/btree/btreerootbase.h
+++ b/vespalib/src/vespa/vespalib/btree/btreerootbase.h
@@ -85,14 +85,10 @@ protected:
void recursiveDelete(BTreeNode::Ref node, NodeAllocatorType &allocator);
};
-extern template class BTreeRootBase<uint32_t, uint32_t, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
-extern template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated,
- BTreeDefaultTraits::INTERNAL_SLOTS,
- BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<uint32_t, uint32_t, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<uint32_t, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<uint32_t, int32_t, MinMaxAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<datastore::AtomicEntryRef, BTreeNoLeafData, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
+extern template class BTreeRootBase<datastore::AtomicEntryRef, datastore::AtomicEntryRef, NoAggregated, BTreeDefaultTraits::INTERNAL_SLOTS, BTreeDefaultTraits::LEAF_SLOTS>;
}
diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
index 9de2628b318..205284ee299 100644
--- a/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
@@ -14,14 +14,14 @@ namespace vespalib::datastore {
*/
class EntryComparator {
public:
- virtual ~EntryComparator() {}
+ virtual ~EntryComparator() = default;
/**
* Returns true if the value represented by lhs ref is less than the value represented by rhs ref.
*/
- virtual bool less(const EntryRef lhs, const EntryRef rhs) const = 0;
- virtual bool equal(const EntryRef lhs, const EntryRef rhs) const = 0;
- virtual size_t hash(const EntryRef rhs) const = 0;
+ virtual bool less(const EntryRef lhs, const EntryRef rhs) const noexcept = 0;
+ virtual bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept = 0;
+ virtual size_t hash(const EntryRef rhs) const noexcept = 0;
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
index e31b639928a..02281ab0435 100644
--- a/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
+++ b/vespalib/src/vespa/vespalib/datastore/entry_comparator_wrapper.h
@@ -12,10 +12,10 @@ namespace vespalib::datastore {
class EntryComparatorWrapper {
const EntryComparator &_comp;
public:
- EntryComparatorWrapper(const EntryComparator &comp)
+ EntryComparatorWrapper(const EntryComparator &comp) noexcept
: _comp(comp)
{ }
- bool operator()(const AtomicEntryRef &lhs, const AtomicEntryRef &rhs) const {
+ bool operator()(const AtomicEntryRef &lhs, const AtomicEntryRef &rhs) const noexcept {
return _comp.less(lhs.load_acquire(), rhs.load_acquire());
}
};
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
index b2c4d4e8d7e..ab2770bc1b0 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
@@ -29,7 +29,7 @@ using DefaultUniqueStoreDictionary = UniqueStoreDictionary<DefaultDictionary>;
template <typename EntryT, typename RefT, typename Comparator, typename Allocator>
UniqueStore<EntryT, RefT, Comparator, Allocator>::UniqueStore(std::shared_ptr<alloc::MemoryAllocator> memory_allocator)
- : UniqueStore(std::move(memory_allocator), [](const auto& data_store) { return ComparatorType(data_store);})
+ : UniqueStore(std::move(memory_allocator), [](const auto& data_store) noexcept { return ComparatorType(data_store);})
{}
template <typename EntryT, typename RefT, typename Comparator, typename Allocator>
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
index 267245bc215..68a0a532ed3 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_comparator.h
@@ -16,13 +16,13 @@ namespace vespalib::datastore {
template <typename EntryT>
class UniqueStoreComparatorHelper {
public:
- static bool less(const EntryT& lhs, const EntryT& rhs) {
+ static bool less(const EntryT& lhs, const EntryT& rhs) noexcept {
return lhs < rhs;
}
- static bool equal(const EntryT& lhs, const EntryT& rhs) {
+ static bool equal(const EntryT& lhs, const EntryT& rhs) noexcept {
return lhs == rhs;
}
- static size_t hash(const EntryT& rhs) {
+ static size_t hash(const EntryT& rhs) noexcept {
vespalib::hash<EntryT> hasher;
return hasher(rhs);
}
@@ -36,7 +36,7 @@ template <typename EntryT>
class UniqueStoreFloatingPointComparatorHelper
{
public:
- static bool less(EntryT lhs, const EntryT rhs) {
+ static bool less(EntryT lhs, const EntryT rhs) noexcept {
if (std::isnan(lhs)) {
return !std::isnan(rhs);
} else if (std::isnan(rhs)) {
@@ -45,7 +45,7 @@ public:
return (lhs < rhs);
}
}
- static bool equal(EntryT lhs, const EntryT rhs) {
+ static bool equal(EntryT lhs, const EntryT rhs) noexcept {
if (std::isnan(lhs)) {
return std::isnan(rhs);
} else if (std::isnan(rhs)) {
@@ -54,7 +54,7 @@ public:
return (lhs == rhs);
}
}
- static size_t hash(EntryT rhs) {
+ static size_t hash(EntryT rhs) noexcept {
if (std::isnan(rhs)) {
return 0;
} else {
@@ -98,7 +98,7 @@ protected:
const DataStoreType &_store;
const EntryType _lookup_value;
- inline const EntryType &get(EntryRef ref) const {
+ const EntryType &get(EntryRef ref) const noexcept {
if (ref.valid()) {
RefType iRef(ref);
return _store.template getEntry<WrappedEntryType>(iRef)->value();
@@ -106,34 +106,34 @@ protected:
return _lookup_value;
}
}
- UniqueStoreComparator(const DataStoreType &store, const EntryType &lookup_value)
+ UniqueStoreComparator(const DataStoreType &store, const EntryType &lookup_value) noexcept
: _store(store),
_lookup_value(lookup_value)
{
}
public:
- UniqueStoreComparator(const DataStoreType &store)
+ UniqueStoreComparator(const DataStoreType &store) noexcept
: _store(store),
_lookup_value()
{
}
- bool less(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const EntryType &lhsValue = get(lhs);
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::less(lhsValue, rhsValue);
}
- bool equal(const EntryRef lhs, const EntryRef rhs) const override {
+ bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const EntryType &lhsValue = get(lhs);
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::equal(lhsValue, rhsValue);
}
- size_t hash(const EntryRef rhs) const override {
+ size_t hash(const EntryRef rhs) const noexcept override {
const EntryType &rhsValue = get(rhs);
return UniqueStoreComparatorHelper<EntryT>::hash(rhsValue);
}
- UniqueStoreComparator<EntryT, RefT> make_for_lookup(const EntryType& lookup_value) const {
+ UniqueStoreComparator<EntryT, RefT> make_for_lookup(const EntryType& lookup_value) const noexcept {
return UniqueStoreComparator<EntryT, RefT>(_store, lookup_value);
}
};
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h b/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h
index b8496f40464..a14e32ab2ad 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_entry_base.h
@@ -15,18 +15,18 @@ namespace vespalib::datastore {
class UniqueStoreEntryBase {
mutable uint32_t _ref_count;
protected:
- constexpr UniqueStoreEntryBase()
+ constexpr UniqueStoreEntryBase() noexcept
: _ref_count(0u)
{
}
public:
- uint32_t get_ref_count() const { return _ref_count; }
- void set_ref_count(uint32_t ref_count) const { _ref_count = ref_count; }
- void inc_ref_count() const {
+ uint32_t get_ref_count() const noexcept { return _ref_count; }
+ void set_ref_count(uint32_t ref_count) const noexcept { _ref_count = ref_count; }
+ void inc_ref_count() const noexcept {
assert(_ref_count < std::numeric_limits<uint32_t>::max());
++_ref_count;
}
- void dec_ref_count() const {
+ void dec_ref_count() const noexcept {
assert(_ref_count > 0u);
--_ref_count;
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
index 1294a936a38..06b51ad301c 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
@@ -32,12 +32,12 @@ uint32_t get_type_id(size_t string_len);
class UniqueStoreSmallStringEntry : public UniqueStoreEntryBase {
char _value[0];
public:
- constexpr UniqueStoreSmallStringEntry()
+ constexpr UniqueStoreSmallStringEntry() noexcept
: UniqueStoreEntryBase(),
_value()
{ }
- UniqueStoreSmallStringEntry(const char *value, size_t value_len, size_t array_size)
+ UniqueStoreSmallStringEntry(const char *value, size_t value_len, size_t array_size) noexcept
: UniqueStoreEntryBase()
{
assert(value_offset() + value_len < array_size);
@@ -45,12 +45,12 @@ public:
memset(&_value[0] + value_len, 0, array_size - value_len - value_offset());
}
- void clean_hold(size_t array_size) {
+ void clean_hold(size_t array_size) noexcept {
memset(&_value[0], 0, array_size - value_offset());
}
- const char *value() const { return &_value[0]; }
- size_t value_offset() const { return &_value[0] - reinterpret_cast<const char *>(this); }
+ const char *value() const noexcept { return &_value[0]; }
+ size_t value_offset() const noexcept { return &_value[0] - reinterpret_cast<const char *>(this); }
};
/*
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
index a0f338ad931..f91f2c1fd9b 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_comparator.h
@@ -23,7 +23,7 @@ protected:
const DataStoreType &_store;
const char *_lookup_value;
- const char *get(EntryRef ref) const {
+ const char *get(EntryRef ref) const noexcept {
if (ref.valid()) {
RefType iRef(ref);
const auto &meta = _store.getBufferMeta(iRef.bufferId());
@@ -37,33 +37,33 @@ protected:
return _lookup_value;
}
}
- UniqueStoreStringComparator(const DataStoreType &store, const char *lookup_value)
+ UniqueStoreStringComparator(const DataStoreType &store, const char *lookup_value) noexcept
: _store(store),
_lookup_value(lookup_value)
{
}
public:
- UniqueStoreStringComparator(const DataStoreType &store)
+ UniqueStoreStringComparator(const DataStoreType &store) noexcept
: _store(store),
_lookup_value(nullptr)
{
}
- bool less(const EntryRef lhs, const EntryRef rhs) const override {
+ bool less(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const char *lhs_value = get(lhs);
const char *rhs_value = get(rhs);
return (strcmp(lhs_value, rhs_value) < 0);
}
- bool equal(const EntryRef lhs, const EntryRef rhs) const override {
+ bool equal(const EntryRef lhs, const EntryRef rhs) const noexcept override {
const char *lhs_value = get(lhs);
const char *rhs_value = get(rhs);
return (strcmp(lhs_value, rhs_value) == 0);
}
- size_t hash(const EntryRef rhs) const override {
+ size_t hash(const EntryRef rhs) const noexcept override {
const char *rhs_value = get(rhs);
vespalib::hash<const char *> hasher;
return hasher(rhs_value);
}
- UniqueStoreStringComparator<RefT> make_for_lookup(const char* lookup_value) const {
+ UniqueStoreStringComparator<RefT> make_for_lookup(const char* lookup_value) const noexcept {
return UniqueStoreStringComparator<RefT>(_store, lookup_value);
}
};
diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h
index b1168c48ccf..26439f16d66 100644
--- a/vespalib/src/vespa/vespalib/text/utf8.h
+++ b/vespalib/src/vespa/vespalib/text/utf8.h
@@ -304,7 +304,7 @@ public:
*
* @return a valid UCS-4 codepoint
**/
- uint32_t getChar() noexcept{ return getChar(Utf8::REPLACEMENT_CHAR); }
+ uint32_t getChar() noexcept { return getChar(Utf8::REPLACEMENT_CHAR); }
/**
* count the number of UCS-4 characters will be returned when