diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-04-03 23:23:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-03 23:23:20 +0200 |
commit | ab62199275b7b92c57507c342381c02a60e5b5af (patch) | |
tree | 148151548e6e6a0de9cd9a3399b1f50a8c990b62 | |
parent | 35c74d9abcfa7abb0cc12c1b47d26bac6f24f997 (diff) | |
parent | b1e3641dc5826ca99558ea51a918542f14568b57 (diff) |
Merge pull request #21957 from vespa-engine/toregge/remove-outdated-andnot-optimization
Remove outdated andnot optimization.
3 files changed, 2 insertions, 94 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index ac408cfb2de..f1243665636 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -18,7 +18,6 @@ LOG_SETUP(".proton.matching.match_thread"); namespace proton::matching { -using search::queryeval::OptimizedAndNotForBlackListing; using search::queryeval::SearchIterator; using search::fef::MatchData; using search::fef::RankProgram; @@ -48,17 +47,6 @@ struct SimpleStrategy { } }; -// seek_next maps to OptimizedAndNotForBlackListing::seekFast -struct FastBlackListingStrategy { - static bool can_use(bool do_rank, bool do_limit, SearchIterator &search) { - return (!do_rank && !do_limit && - (dynamic_cast<OptimizedAndNotForBlackListing *>(&search) != nullptr)); - } - static uint32_t seek_next(SearchIterator &search, uint32_t docid) { - return static_cast<OptimizedAndNotForBlackListing &>(search).seekFast(docid); - } -}; - LazyValue get_score_feature(const RankProgram &rankProgram) { FeatureResolver resolver(rankProgram.get_seeds()); assert(resolver.num_features() == 1u); @@ -222,11 +210,7 @@ template <bool do_rank, bool do_limit, bool do_share, bool use_rank_drop_limit> void MatchThread::match_loop_helper_rank_limit_share_drop(MatchTools &tools, HitCollector &hits) { - if (FastBlackListingStrategy::can_use(do_rank, do_limit, tools.search())) { - match_loop<FastBlackListingStrategy, do_rank, do_limit, do_share, use_rank_drop_limit>(tools, hits); - } else { - match_loop<SimpleStrategy, do_rank, do_limit, do_share, use_rank_drop_limit>(tools, hits); - } + match_loop<SimpleStrategy, do_rank, do_limit, do_share, use_rank_drop_limit>(tools, hits); } template <bool do_rank, bool do_limit, bool do_share> diff --git a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp index 2307b778381..c7b81bc9da7 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp @@ -105,41 +105,11 @@ AndNotSearchStrict::internalSeek(uint32_t docid) } // namespace -OptimizedAndNotForBlackListing::OptimizedAndNotForBlackListing(MultiSearch::Children children) : - AndNotSearchStrictBase(std::move(children)) -{ -} - -void OptimizedAndNotForBlackListing::initRange(uint32_t beginid, uint32_t endid) -{ - AndNotSearch::initRange(beginid, endid); - setDocId(internalSeek<false>(beginid)); -} - -bool OptimizedAndNotForBlackListing::isBlackListIterator(const SearchIterator * iterator) -{ - return dynamic_cast<const BlackListIterator *>(iterator) != 0; -} - -void OptimizedAndNotForBlackListing::doSeek(uint32_t docid) -{ - setDocId(internalSeek<true>(docid)); -} - -void OptimizedAndNotForBlackListing::doUnpack(uint32_t docid) -{ - positive()->doUnpack(docid); -} - std::unique_ptr<SearchIterator> AndNotSearch::create(ChildrenIterators children_in, bool strict) { MultiSearch::Children children = std::move(children_in); if (strict) { - if ((children.size() == 2) && OptimizedAndNotForBlackListing::isBlackListIterator(children[1].get())) { - return std::make_unique<OptimizedAndNotForBlackListing>(std::move(children)); - } else { - return std::make_unique<AndNotSearchStrict>(std::move(children)); - } + return std::make_unique<AndNotSearchStrict>(std::move(children)); } else { return SearchIterator::UP(new AndNotSearch(std::move(children))); } diff --git a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h index d65a3d9c72e..e474ab7c90c 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h @@ -48,50 +48,4 @@ private: UP andWith(UP filter, uint32_t estimate) override; }; -/** - * This is a specialized andnot iterator you get when you have no andnot's in you query and only get the blacklist blueprint. - * This one is now constructed at getSearch() phase. However this should be better handled in the AndNotBlueprint. - */ -class OptimizedAndNotForBlackListing : public AndNotSearchStrictBase -{ -private: - // This is the actual iterator that should be produced by the documentmetastore in searchcore, but that - // will probably be changed later on. An ordinary bitvector could be even better as that would open up for more optimizations. - //typedef FilterAttributeIteratorT<SingleValueSmallNumericAttribute::SingleSearchContext> BlackListIterator; - typedef AttributeIteratorT<SingleValueSmallNumericAttribute::SingleSearchContext> BlackListIterator; -public: - OptimizedAndNotForBlackListing(MultiSearch::Children children); - static bool isBlackListIterator(const SearchIterator * iterator); - - uint32_t seekFast(uint32_t docid) { - return internalSeek<true>(docid); - } - void initRange(uint32_t beginid, uint32_t endid) override; -private: - SearchIterator * positive() { return getChildren()[0].get(); } - BlackListIterator * blackList() { return static_cast<BlackListIterator *>(getChildren()[1].get()); } - template<bool doSeekOnly> - uint32_t internalSeek(uint32_t docid) { - uint32_t curr(docid); - while (true) { - if (doSeekOnly) { - positive()->doSeek(curr); - } else { - positive()->seek(curr); - } - if ( ! positive()->isAtEnd() ) { - curr = positive()->getDocId(); - if (! blackList()->seekFast(curr)) { - return curr; - } - curr++; - } else { - return search::endDocId; - } - } - } - void doSeek(uint32_t docid) override; - void doUnpack(uint32_t docid) override; -}; - } |