aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/queryeval/simplesearch.cpp
blob: e39ab1ab8f9579243a7e958e0e664c3499589637 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "simplesearch.h"
#include <vespa/vespalib/objects/visit.h>

namespace search::queryeval {

void
SimpleSearch::doSeek(uint32_t docid)
{
    while (_index < _result.getHitCount() && _result.getHit(_index) < docid) {
        ++_index;
    }
    auto candidate = (_index < _result.getHitCount())
        ? _result.getHit(_index) : search::endDocId;
    if ((candidate == docid) || _strict) {
        setDocId(candidate);
    }
}

void
SimpleSearch::doUnpack(uint32_t docid)
{
    (void) docid;
}

SimpleSearch::SimpleSearch(const SimpleResult &result, bool strict)
  : _tag("<null>"),
    _result(result),
    _index(0),
    _strict(strict)
{
}

void
SimpleSearch::initRange(uint32_t begin_id, uint32_t end_id)
{
    SearchIterator::initRange(begin_id, end_id);
    _index = 0;
}

void
SimpleSearch::visitMembers(vespalib::ObjectVisitor &visitor) const
{
    visit(visitor, "tag", _tag);
}

SimpleSearch::~SimpleSearch() = default;

}