aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/multi_enum_search_context.hpp
blob: 352c6ea5f2342413b175d43e5fcb318d283bdf06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "multi_enum_search_context.h"
#include "attributeiterators.hpp"
#include <vespa/searchlib/queryeval/emptysearch.h>

namespace search::attribute {

template <typename T, typename BaseSC, typename M>
MultiEnumSearchContext<T, BaseSC, M>::MultiEnumSearchContext(typename BaseSC::MatcherType&& matcher, const AttributeVector& toBeSearched, MultiValueMappingReadView<M> mv_mapping_read_view, const EnumStoreT<T>& enum_store)
    : BaseSC(toBeSearched, std::move(matcher)),
      _mv_mapping_read_view(mv_mapping_read_view),
      _enum_store(enum_store)
{
}

template <typename T, typename BaseSC, typename M>
std::unique_ptr<queryeval::SearchIterator>
MultiEnumSearchContext<T, BaseSC, M>::createFilterIterator(fef::TermFieldMatchData* matchData, bool strict)
{
    if (!this->valid()) {
        return std::make_unique<queryeval::EmptySearch>();
    }
    if (this->getIsFilter()) {
        return strict
            ? std::make_unique<FilterAttributeIteratorStrict<MultiEnumSearchContext>>(*this, matchData)
            : std::make_unique<FilterAttributeIteratorT<MultiEnumSearchContext>>(*this, matchData);
    }
    return strict
        ? std::make_unique<AttributeIteratorStrict<MultiEnumSearchContext>>(*this, matchData)
        : std::make_unique<AttributeIteratorT<MultiEnumSearchContext>>(*this, matchData);
}

template <typename T, typename BaseSC, typename M>
uint32_t
MultiEnumSearchContext<T, BaseSC, M>::get_committed_docid_limit() const noexcept
{
    return _mv_mapping_read_view.get_committed_docid_limit();
}

}