aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/diskindex/disktermblueprint.h
blob: 30e8f55b5b72d73e2a91c2961678099d87c97ee4 (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
44
45
46
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "diskindex.h"
#include <vespa/searchlib/queryeval/blueprint.h>

namespace search::diskindex {

/**
 * Blueprint implementation for term searching in a disk index.
 **/
class DiskTermBlueprint : public search::queryeval::SimpleLeafBlueprint
{
private:
    search::queryeval::FieldSpecBase             _field;
    const search::diskindex::DiskIndex        &  _diskIndex;
    DiskIndex::LookupResult::UP                  _lookupRes;
    bool                                         _useBitVector;
    bool                                         _fetchPostingsDone;
    bool                                         _hasEquivParent;
    search::index::PostingListHandle::UP         _postingHandle;
    search::BitVector::UP                        _bitVector;

public:
    /**
     * Create a new blueprint.
     *
     * @param field        the field to search in.
     * @param diskIndex    the disk index used to read the bit vector or posting list.
     * @param lookupRes    the result after disk dictionary lookup.
     * @param useBitVector whether or not we should use bit vector.
     **/
    DiskTermBlueprint(const search::queryeval::FieldSpecBase & field,
                      const search::diskindex::DiskIndex & diskIndex,
                      search::diskindex::DiskIndex::LookupResult::UP lookupRes,
                      bool useBitVector);

    // Inherit doc from Blueprint.
    // For now, this DiskTermBlueprint instance must have longer lifetime than the created iterator.
    std::unique_ptr<queryeval::SearchIterator> createLeafSearch(const fef::TermFieldMatchDataArray & tfmda, bool strict) const override;

    void fetchPostings(bool strict, const BitVector * filter) override;
};

}