aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/matching/isearchcontext.h
blob: ab929e041465add7989fec1455e5ffc31372f199 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <memory>

namespace search::queryeval { class Searchable; }
namespace searchcorespi { class IndexSearchable; }

namespace proton::matching {

/**
 * Interface used to expose searchable data to the matching
 * pipeline. Ownership of the objects exposed through this interface
 * is handled by the implementation. Cleanup is triggered by deleting
 * the context interface. All searchable attributes are exposed
 * through a single instance of the Searchable interface. Indexed
 * fields are exposed as multiple Searchable instances that are
 * assigned separate source ids. A source selector is used to
 * determine which source should be used for each document.
 **/
class ISearchContext
{
protected:
    ISearchContext() = default;
public:
    ISearchContext(const ISearchContext &) = delete;
    ISearchContext & operator = (const ISearchContext &) = delete;

    using Searchable = search::queryeval::Searchable;
    using IndexSearchable = searchcorespi::IndexSearchable;

    /**
     * Obtain the index fields searchable.
     *
     * @return index fields searchable.
     **/
    virtual IndexSearchable &getIndexes() = 0;

    /**
     * Obtain the attribute fields searchable.
     *
     * @return attribute fields searchable.
     **/
    virtual Searchable &getAttributes() = 0;

    /**
     * Obtain the limit value for local document ids. This value is
     * larger than all local docids that are currently in use. It will
     * be used both to terminate matching and as an estimate on the
     * total number of documents.
     *
     * @return local document id limit value
     **/
    virtual uint32_t getDocIdLimit() = 0;

    /**
     * Deleting the context will trigger cleanup in the
     * implementation.
     **/
    virtual ~ISearchContext() = default;
};

}