aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.h
blob: 9c868bb1454d0099abb592deb1b5cd1385e75a10 (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/document/base/globalid.h>
#include <vespa/searchlib/attribute/search_context.h>

namespace proton { class DocumentMetaStore; }
namespace proton::documentmetastore {

/**
 * Search context used to search the document meta store for all valid documents.
 */
class SearchContext : public search::attribute::SearchContext
{
private:
    using DocId = uint32_t;

    bool _isWord;
    document::GlobalId _gid;
    uint32_t _docid_limit;

    unsigned int approximateHits() const override;
    int32_t onFind(DocId docId, int32_t elemId, int32_t &weight) const override;
    int32_t onFind(DocId docId, int32_t elemId) const override;

    std::unique_ptr<search::queryeval::SearchIterator>
    createIterator(search::fef::TermFieldMatchData *matchData, bool strict) override;

    const DocumentMetaStore &getStore() const;

public:
    SearchContext(std::unique_ptr<search::QueryTermSimple> qTerm, const DocumentMetaStore &toBeSearched);
    uint32_t get_committed_docid_limit() const noexcept override;
};

}