blob: ac1eeb63578c055c6aef7f4908a22fe9e1c71d32 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "multisearch.h"
#include <vespa/searchlib/attribute/attributeiterators.h>
#include <vespa/searchlib/attribute/singlesmallnumericattribute.h>
namespace search::queryeval {
/**
* A simple implementation of the AndNot search operation.
**/
class AndNotSearch : public MultiSearch
{
protected:
void doSeek(uint32_t docid) override;
void doUnpack(uint32_t docid) override;
Trinary is_strict() const override { return Trinary::False; }
/**
* Create a new AndNot Search with the given children.
*A AndNot has no strictness assumptions about its children.
*
* @param children the search objects we are andnot'ing
**/
AndNotSearch(MultiSearch::Children children) : MultiSearch(std::move(children)) { }
public:
static std::unique_ptr<SearchIterator> create(ChildrenIterators 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;
private:
bool isAndNot() const override { return true; }
bool needUnpack(size_t index) const override {
return index == 0;
}
};
class AndNotSearchStrictBase : public AndNotSearch
{
protected:
AndNotSearchStrictBase(Children children) : AndNotSearch(std::move(children)) { }
private:
Trinary is_strict() const override { return Trinary::True; }
UP andWith(UP filter, uint32_t estimate) override;
};
}
|