aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/attribute_weighted_set_blueprint.h
blob: b238023559c4f8c74f8b8c62ade26fd72a554743 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "attributeguard.h"
#include <vespa/searchlib/queryeval/blueprint.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vector>

namespace search {

namespace attribute { class ISearchContext; }

class AttributeWeightedSetBlueprint : public queryeval::ComplexLeafBlueprint
{
private:
    using ISearchContext = attribute::ISearchContext;
    using IAttributeVector = attribute::IAttributeVector;
    size_t                     _numDocs;
    size_t                     _estHits;
    std::vector<int32_t>       _weights;
    const IAttributeVector    & _attr;
    std::vector<ISearchContext*> _contexts;

    AttributeWeightedSetBlueprint(const AttributeWeightedSetBlueprint &); // disabled
    AttributeWeightedSetBlueprint &operator=(const AttributeWeightedSetBlueprint &); // disabled

public:
    AttributeWeightedSetBlueprint(const queryeval::FieldSpec &field, const IAttributeVector & attr);
    ~AttributeWeightedSetBlueprint();
    void addToken(std::unique_ptr<ISearchContext> context, int32_t weight);
    queryeval::SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
    void fetchPostings(bool strict, const BitVector * filter) override;
};

} // namespace search