blob: 59c5769a1a28e4468f5958e0c6a325754ca13c7a (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "multisearch.h"
#include "unpackinfo.h"
namespace search::queryeval {
/**
* A simple implementation of the And search operation.
**/
class AndSearch : public MultiSearch
{
public:
// Caller takes ownership of the returned SearchIterator.
static AndSearch *create(const Children &children, bool strict, const UnpackInfo & unpackInfo);
static AndSearch *create(const Children &children, bool strict);
std::unique_ptr<BitVector> get_hits(uint32_t begin_id) override;
void or_hits_into(BitVector &result, uint32_t begin_id) override;
void and_hits_into(BitVector &result, uint32_t begin_id) override;
AndSearch & estimate(uint32_t est) { _estimate = est; return *this; }
uint32_t estimate() const { return _estimate; }
protected:
AndSearch(const Children & children);
void doUnpack(uint32_t docid) override;
UP andWith(UP filter, uint32_t estimate) override;
UP offerFilterToChildren(UP filter, uint32_t estimate);
private:
bool isAnd() const override { return true; }
uint32_t _estimate;
};
}
|