diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-27 12:53:23 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-27 12:53:23 +0000 |
commit | 7ed0c4407e8e650f367cd73837d1040191993d5e (patch) | |
tree | c184d667fc048c63c50120dd8557365ce809b890 /searchlib/src | |
parent | 7b09111c932000842043a9d24cda8ab8df45ed4a (diff) |
Double check unfolded if search is cased.
Diffstat (limited to 'searchlib/src')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h index dac3a1f7453..dbb0814dad1 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h @@ -180,18 +180,11 @@ class StringPostingSearchContext : public PostingSearchContext<BaseSC, PostingListFoldedSearchContextT<DataT>, AttrT> { private: - using AggregationTraits = PostingListTraits<DataT>; - using PostingList = typename AggregationTraits::PostingList; using Parent = PostingSearchContext<BaseSC, PostingListFoldedSearchContextT<DataT>, AttrT>; using RegexpUtil = vespalib::RegexpUtil; using QueryTermSimpleUP = typename Parent::QueryTermSimpleUP; - using Parent::_toBeSearched; using Parent::_enumStore; - using Parent::isRegex; - using Parent::getRegex; - bool useThis(const PostingListSearchContext::DictionaryConstIterator & it) const override { - return isRegex() ? (getRegex().valid() ? getRegex().partial_match(_enumStore.get_value(it.getKey())) : false ) : true; - } + bool useThis(const PostingListSearchContext::DictionaryConstIterator & it) const override; public: StringPostingSearchContext(QueryTermSimpleUP qTerm, bool useBitVector, const AttrT &toBeSearched); }; @@ -201,10 +194,7 @@ class NumericPostingSearchContext : public PostingSearchContext<BaseSC, PostingListSearchContextT<DataT>, AttrT> { private: - typedef PostingSearchContext<BaseSC, PostingListSearchContextT<DataT>, AttrT> Parent; - typedef PostingListTraits<DataT> AggregationTraits; - typedef typename AggregationTraits::PostingList PostingList; - typedef typename Parent::EnumStore::ComparatorType ComparatorType; + using Parent = PostingSearchContext<BaseSC, PostingListSearchContextT<DataT>, AttrT>; typedef typename AttrT::T BaseType; using Params = attribute::SearchContextParams; using QueryTermSimpleUP = typename Parent::QueryTermSimpleUP; @@ -300,6 +290,18 @@ StringPostingSearchContext(QueryTermSimpleUP qTerm, bool useBitVector, const Att } } +template <typename BaseSC, typename AttrT, typename DataT> +bool +StringPostingSearchContext<BaseSC, AttrT, DataT>::useThis(const PostingListSearchContext::DictionaryConstIterator & it) const { + if ( this->isCased() ) { + this->isMatch(_enumStore.get_value(it.getKey())); + } else if ( this->isRegex() ) { + return this->getRegex().valid() + ? this->getRegex().partial_match(_enumStore.get_value(it.getKey())) + : false; + } + return true; +} template <typename BaseSC, typename AttrT, typename DataT> NumericPostingSearchContext<BaseSC, AttrT, DataT>:: |