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

#pragma once

#include <memory>

namespace search::queryeval { class SearchIterator; }
namespace search::fef { class TermFieldMatchData; }
namespace search { class BitVector; }

namespace search::attribute {


/**
 * Interface for search context helper classes to create attribute
 * search iterators based on posting lists and using dictionary
 * information to better estimate number of hits.  Also used for
 * enumerated attributes without posting lists to eliminate brute
 * force searches for nonexisting values.
 */

class IPostingListSearchContext
{
protected:
    IPostingListSearchContext() { }
    virtual ~IPostingListSearchContext() { }

public:
    /**
     * Will load/prepare any postings lists. Will take strictness and optional filter into account.
     * @param strict If true iterator must advance to next valid docid.
     * @param filter Any prefilter that can be applied to posting lists for optimization purposes.
     */
    virtual void fetchPostings(bool strict, const BitVector * filter) = 0;
    virtual std::unique_ptr<queryeval::SearchIterator> createPostingIterator(fef::TermFieldMatchData *matchData, bool strict) = 0;
    virtual unsigned int approximateHits() const = 0;
};

}