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

#pragma once

#include <vespa/searchcommon/attribute/hit_estimate.h>
#include <memory>

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

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:
    virtual void fetchPostings(const queryeval::ExecuteInfo & execInfo, bool strict) = 0;
    virtual std::unique_ptr<queryeval::SearchIterator> createPostingIterator(fef::TermFieldMatchData *matchData, bool strict) = 0;
    virtual HitEstimate calc_hit_estimate() const = 0;
};

}