diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-04-03 23:34:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-03 23:34:15 +0200 |
commit | 00641e5eef7d792ff376d20922f451de042539c2 (patch) | |
tree | 0a0de0af7cb72067f062675b2937bf90051c5604 /searchlib/src/vespa/searchlib/attribute/single_small_numeric_search_context.cpp | |
parent | ab62199275b7b92c57507c342381c02a60e5b5af (diff) | |
parent | a9197eae34dd3d0bec1e0c55e52aa37f5cfcd1a3 (diff) |
Merge pull request #21958 from vespa-engine/toregge/factor-out-single-small-numeric-search-context-from-single-small-numeric-attributev7.569.71
Factor out SingleSmallNumericSearchContext from SingleSmallNumericAttribute.
Diffstat (limited to 'searchlib/src/vespa/searchlib/attribute/single_small_numeric_search_context.cpp')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/single_small_numeric_search_context.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/single_small_numeric_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/single_small_numeric_search_context.cpp new file mode 100644 index 00000000000..5eeef7cd61a --- /dev/null +++ b/searchlib/src/vespa/searchlib/attribute/single_small_numeric_search_context.cpp @@ -0,0 +1,35 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "single_small_numeric_search_context.h" +#include "attributeiterators.hpp" +#include <vespa/searchlib/queryeval/emptysearch.h> + +namespace search::attribute { + +SingleSmallNumericSearchContext::SingleSmallNumericSearchContext(std::unique_ptr<QueryTermSimple> qTerm, const AttributeVector& toBeSearched, const Word* word_data, Word value_mask, uint32_t value_shift_shift, uint32_t value_shift_mask, uint32_t word_shift) + : NumericSearchContext<NumericRangeMatcher<T>>(toBeSearched, *qTerm, false), + _wordData(word_data), + _valueMask(value_mask), + _valueShiftShift(value_shift_shift), + _valueShiftMask(value_shift_mask), + _wordShift(word_shift) +{ +} + +std::unique_ptr<queryeval::SearchIterator> +SingleSmallNumericSearchContext::createFilterIterator(fef::TermFieldMatchData* matchData, bool strict) +{ + if (!valid()) { + return std::make_unique<queryeval::EmptySearch>(); + } + if (getIsFilter()) { + return strict + ? std::make_unique<FilterAttributeIteratorStrict<SingleSmallNumericSearchContext>>(*this, matchData) + : std::make_unique<FilterAttributeIteratorT<SingleSmallNumericSearchContext>>(*this, matchData); + } + return strict + ? std::make_unique<AttributeIteratorStrict<SingleSmallNumericSearchContext>>(*this, matchData) + : std::make_unique<AttributeIteratorT<SingleSmallNumericSearchContext>>(*this, matchData); +} + +} |