diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-04 10:27:31 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-04 10:27:31 +0000 |
commit | b893ad2f51c0822ae14beec188bdfa0feb3b07e9 (patch) | |
tree | e0a1bf40f17f642a26640e7795766efeb408b28e /searchlib | |
parent | 23e4abe3283fd22a397b768f5ce3ae5787551484 (diff) |
Remove the need for friend declarations.
Diffstat (limited to 'searchlib')
6 files changed, 13 insertions, 22 deletions
diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp index 46157385f44..bde75edcd03 100644 --- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp +++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp @@ -453,8 +453,7 @@ PostingListAttributeTest::checkPostingList(const VectorType & vec, const std::ve const uint32_t docBegin = range.getBegin(i); const uint32_t docEnd = range.getEnd(i); - auto itr = dict.find(typename VectorType::EnumIndex(), - enumStore.make_comparator(values[i])); + auto itr = dict.find(enumstore::Index(), enumStore.make_comparator(values[i])); ASSERT_TRUE(itr.valid()); typename VectorType::PostingList::Iterator postings; diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp index bb7d004e4ce..464a5f79937 100644 --- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp +++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp @@ -408,4 +408,4 @@ TEST("testSingleValue") } } -TEST_MAIN() { TEST_RUN_ALL(); }
\ No newline at end of file +TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h index c07e4c04458..c324ecdf125 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h @@ -41,10 +41,6 @@ private: }; DocumentWeightAttributeAdapter _document_weight_attribute_adapter; - friend class PostingListAttributeTest; - template <typename, typename, typename> - friend class attribute::PostingSearchContext; // getEnumStore() - using LoadedVector = typename B::LoadedVector; using PostingParent = PostingListAttributeSubBase<AttributeWeightPosting, LoadedVector, @@ -52,14 +48,10 @@ private: typename B::EnumStore>; using ComparatorType = typename EnumStore::ComparatorType; - using Dictionary = EnumPostingTree; - using DictionaryConstIterator = typename Dictionary::ConstIterator; using DocId = typename MultiValueStringAttributeT<B, T>::DocId; using DocIndices = typename MultiValueStringAttributeT<B, T>::DocIndices; - using EnumIndex = typename EnumStore::Index; using LoadedEnumAttributeVector = attribute::LoadedEnumAttributeVector; using Posting = typename PostingParent::Posting; - using PostingList = typename PostingParent::PostingList; using PostingMap = typename PostingParent::PostingMap; using QueryTermSimpleUP = AttributeVector::QueryTermSimpleUP; using SelfType = MultiValueStringPostingAttributeT<B, T>; @@ -81,6 +73,10 @@ private: void applyValueChanges(const DocIndices& docIndices, EnumStoreBatchUpdater& updater) override ; public: + using PostingParent::getPostingList; + using Dictionary = EnumPostingTree; + using PostingList = typename PostingParent::PostingList; + MultiValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c = AttributeVector::Config(AttributeVector::BasicType::STRING, attribute::CollectionType::ARRAY)); diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp index 4263eacfa52..25d7858ea81 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp @@ -111,11 +111,11 @@ IDocumentWeightAttribute::LookupResult MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::lookup(const vespalib::string &term, vespalib::datastore::EntryRef dictionary_snapshot) const { const Dictionary &dictionary = self._enumStore.get_posting_dictionary(); - DictionaryConstIterator dictItr(vespalib::btree::BTreeNode::Ref(), dictionary.getAllocator()); + Dictionary::ConstIterator dictItr(vespalib::btree::BTreeNode::Ref(), dictionary.getAllocator()); auto comp = self._enumStore.make_folded_comparator(term.c_str()); - dictItr.lower_bound(dictionary_snapshot, EnumIndex(), comp); - if (dictItr.valid() && !comp(EnumIndex(), dictItr.getKey())) { + dictItr.lower_bound(dictionary_snapshot, enumstore::Index(), comp); + if (dictItr.valid() && !comp(enumstore::Index(), dictItr.getKey())) { vespalib::datastore::EntryRef pidx(dictItr.getData()); if (pidx.valid()) { const PostingList &plist = self.getPostingList(); @@ -131,7 +131,7 @@ void MultiValueStringPostingAttributeT<B, T>::DocumentWeightAttributeAdapter::collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot, const std::function<void(vespalib::datastore::EntryRef)>& callback) const { const Dictionary &dictionary = self._enumStore.get_posting_dictionary(); - DictionaryConstIterator dictItr(vespalib::btree::BTreeNode::Ref(), dictionary.getAllocator()); + Dictionary::ConstIterator dictItr(vespalib::btree::BTreeNode::Ref(), dictionary.getAllocator()); auto comp = self._enumStore.make_folded_comparator(); dictItr.lower_bound(dictionary_snapshot, enum_idx, comp); while (dictItr.valid() && !comp(enum_idx, dictItr.getKey())) { diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h index f5160313132..b8edce00ba7 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h @@ -252,7 +252,7 @@ PostingSearchContext(QueryTermSimpleUP qTerm, bool useBitVector, const AttrT &to toBeSearched.getStatus().getNumValues(), toBeSearched.hasWeightedSetType(), toBeSearched.getPostingList(), - toBeSearched._postingList._minBvDocFreq, + toBeSearched.getPostingList()._minBvDocFreq, useBitVector, *this), _toBeSearched(toBeSearched), diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h index e19b5d41187..60a4bc022be 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h @@ -26,10 +26,6 @@ public: using EnumStoreBatchUpdater = typename EnumStore::BatchUpdater; private: - friend class PostingListAttributeTest; - template <typename, typename, typename> - friend class attribute::PostingSearchContext; // getEnumStore() - using LoadedVector = typename B::LoadedVector; using PostingParent = PostingListAttributeSubBase<AttributePosting, LoadedVector, @@ -39,11 +35,9 @@ private: using Change = StringAttribute::Change; using ChangeVector = StringAttribute::ChangeVector; using ComparatorType = typename EnumStore::ComparatorType; - using Dictionary = EnumPostingTree; using DocId = typename SingleValueStringAttributeT<B>::DocId; using EnumIndex = typename SingleValueStringAttributeT<B>::EnumIndex; using LoadedEnumAttributeVector = attribute::LoadedEnumAttributeVector; - using PostingList = typename PostingParent::PostingList; using PostingMap = typename PostingParent::PostingMap; using QueryTermSimpleUP = AttributeVector::QueryTermSimpleUP; using SelfType = SingleValueStringPostingAttributeT<B>; @@ -60,6 +54,8 @@ private: using PostingParent::handle_load_posting_lists_and_update_enum_store; using PostingParent::forwardedOnAddDoc; public: + using PostingList = typename PostingParent::PostingList; + using Dictionary = EnumPostingTree; using PostingParent::getPostingList; private: |