diff options
Diffstat (limited to 'searchlib')
4 files changed, 4 insertions, 51 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.cpp b/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.cpp index db63ddbb3ff..4fec660468b 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.cpp @@ -13,8 +13,7 @@ EnumHintSearchContext:: EnumHintSearchContext(const EnumStoreDictBase &dictionary, uint32_t docIdLimit, uint64_t numValues) - : _dictionary(dictionary), - _frozenRootRef(dictionary.get_frozen_root()), + : _dict_snapshot(dictionary.get_read_snapshot()), _uniqueValues(0u), _docIdLimit(docIdLimit), _numValues(numValues) @@ -28,7 +27,7 @@ EnumHintSearchContext::~EnumHintSearchContext() = default; void EnumHintSearchContext::lookupTerm(const EnumStoreComparator &comp) { - _uniqueValues = _dictionary.lookupFrozenTerm(_frozenRootRef, comp); + _uniqueValues = _dict_snapshot->count(comp); } @@ -36,7 +35,7 @@ void EnumHintSearchContext::lookupRange(const EnumStoreComparator &low, const EnumStoreComparator &high) { - _uniqueValues = _dictionary.lookupFrozenRange(_frozenRootRef, low, high); + _uniqueValues = _dict_snapshot->count_in_range(low, high); } void diff --git a/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.h index 7d6d31fce50..1844c228014 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/enumhintsearchcontext.h @@ -15,8 +15,7 @@ namespace search::attribute { class EnumHintSearchContext : public IPostingListSearchContext { - const EnumStoreDictBase &_dictionary; - const btree::BTreeNode::Ref _frozenRootRef; + const EnumStoreDictBase::ReadSnapshot::UP _dict_snapshot; uint32_t _uniqueValues; uint32_t _docIdLimit; uint64_t _numValues; // attr.getStatus().getNumValues(); diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp b/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp index a7a6a9a692d..196a1ee056a 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.cpp @@ -435,37 +435,6 @@ EnumStoreDict<Dictionary>::onReset() this->_dict.clear(); } -template <typename Dictionary> -uint32_t -EnumStoreDict<Dictionary>::lookupFrozenTerm(BTreeNode::Ref frozenRootRef, - const datastore::EntryComparator &comp) const -{ - typename Dictionary::ConstIterator itr(BTreeNode::Ref(), - this->_dict.getAllocator()); - itr.lower_bound(frozenRootRef, Index(), comp); - if (itr.valid() && !comp(Index(), itr.getKey())) { - return 1u; - } - return 0u; -} - -template <typename Dictionary> -uint32_t -EnumStoreDict<Dictionary>:: -lookupFrozenRange(BTreeNode::Ref frozenRootRef, - const datastore::EntryComparator &low, - const datastore::EntryComparator &high) const -{ - typename Dictionary::ConstIterator lowerDictItr(BTreeNode::Ref(), - this->_dict.getAllocator()); - lowerDictItr.lower_bound(frozenRootRef, Index(), low); - auto upperDictItr = lowerDictItr; - if (upperDictItr.valid() && !high(Index(), upperDictItr.getKey())) { - upperDictItr.seekPast(Index(), high); - } - return upperDictItr - lowerDictItr; -} - template <> EnumPostingTree & diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h index 2b4d0d4b110..02fd97d7321 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h +++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h @@ -81,13 +81,6 @@ public: virtual void onReset() = 0; virtual btree::BTreeNode::Ref getFrozenRootRef() const = 0; - virtual uint32_t lookupFrozenTerm(btree::BTreeNode::Ref frozenRootRef, - const datastore::EntryComparator &comp) const = 0; - - virtual uint32_t lookupFrozenRange(btree::BTreeNode::Ref frozenRootRef, - const datastore::EntryComparator &low, - const datastore::EntryComparator &high) const = 0; - virtual EnumPostingTree &getPostingDictionary() = 0; virtual const EnumPostingTree &getPostingDictionary() const = 0; virtual bool hasData() const = 0; @@ -139,13 +132,6 @@ public: void onReset() override; btree::BTreeNode::Ref getFrozenRootRef() const override { return this->get_frozen_root(); } - uint32_t lookupFrozenTerm(btree::BTreeNode::Ref frozenRootRef, - const datastore::EntryComparator &comp) const override; - - uint32_t lookupFrozenRange(btree::BTreeNode::Ref frozenRootRef, - const datastore::EntryComparator &low, - const datastore::EntryComparator &high) const override; - EnumPostingTree & getPostingDictionary() override; const EnumPostingTree & getPostingDictionary() const override; |