blob: 00e75f4484463b8bfeb83b20c60afd0ff1affc3a (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "andsearch.h"
#include "irequestcontext.h"
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
#include <memory>
#include <vector>
namespace search::queryeval {
/**
* Search iterator for a phrase, based on a set of child search iterators.
*/
class SimplePhraseSearch : public AndSearch
{
fef::MatchData::UP _md;
fef::TermFieldMatchDataArray _childMatch;
std::vector<uint32_t> _eval_order;
fef::TermFieldMatchData &_tmd;
bool _strict;
using It = fef::TermFieldMatchData::PositionsIterator;
// Reuse this vector instead of allocating a new one when needed.
std::vector<It> _iterators;
void phraseSeek(uint32_t doc_id);
public:
/**
* Takes ownership of the contents of children.
* If this iterator is strict, the first child also needs to be strict.
*
* @param children SearchIterator objects for each child.
* @param tmds TermFieldMatchData for the children.
* @param eval_order determines the order of evaluation for the
* terms. The term with fewest hits should be
* evaluated first.
**/
SimplePhraseSearch(Children children,
fef::MatchData::UP md,
fef::TermFieldMatchDataArray childMatch,
std::vector<uint32_t> eval_order,
fef::TermFieldMatchData &tmd, bool strict);
void doSeek(uint32_t doc_id) override;
void doUnpack(uint32_t doc_id) override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
};
}
|