aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/matching/rangequerylocator.h
blob: 8df47db56052d0a60574364bc4932c4bcad85191 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/stllike/string.h>

namespace search::queryeval { class Blueprint; }

namespace proton::matching {

class RangeLimitMetaInfo {
public:
    RangeLimitMetaInfo();
    RangeLimitMetaInfo(vespalib::stringref low, vespalib::stringref high, size_t estimate);
    ~RangeLimitMetaInfo();
    const vespalib::string & low() const { return _low; }
    const vespalib::string & high() const { return _high; }
    bool valid() const { return _valid; }
    size_t estimate() const { return _estimate; }
private:
    bool             _valid;
    size_t           _estimate;
    vespalib::string _low;
    vespalib::string _high;
};

class RangeQueryLocator {
public:
    virtual ~RangeQueryLocator() = default;
    virtual RangeLimitMetaInfo locate() const = 0;
};

class LocateRangeItemFromQuery : public RangeQueryLocator {
public:
    LocateRangeItemFromQuery(const search::queryeval::Blueprint & blueprint, uint32_t field_id)
        : _blueprint(blueprint),
          _field_id(field_id)
    {}
    RangeLimitMetaInfo locate() const override;
private:
    const search::queryeval::Blueprint & _blueprint;
    uint32_t _field_id;
};

}