-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsphinxfilter.h
67 lines (52 loc) · 2.14 KB
/
sphinxfilter.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// $Id$
//
//
// Copyright (c) 2001-2015, Andrew Aksyonoff
// Copyright (c) 2008-2015, Sphinx Technologies Inc
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
// received a copy of the GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org/
//
#ifndef _sphinxfilter_
#define _sphinxfilter_
#include "sphinx.h"
struct ISphFilter
{
virtual void SetLocator ( const CSphAttrLocator & ) {}
virtual void SetRange ( SphAttr_t, SphAttr_t ) {}
virtual void SetRangeFloat ( float, float ) {}
virtual void SetValues ( const SphAttr_t *, int ) {}
virtual void SetMVAStorage ( const DWORD *, bool ) {}
virtual void SetStringStorage ( const BYTE * ) {}
virtual void SetRefString ( const CSphString & ) {}
virtual ~ISphFilter () {}
virtual ISphFilter * Optimize() { return this; }
/// evaluate filter for a given match
/// returns true if match satisfies the filter critertia (i.e. in range, found in values list etc)
virtual bool Eval ( const CSphMatch & tMatch ) const = 0;
/// evaluate filter for a given block
/// args are pMinDocinfo and pMaxDocinfo
/// returns false if no document in block can possibly pass through the filter
virtual bool EvalBlock ( const DWORD *, const DWORD * ) const
{
// if filter does not implement block-level evaluation we assume the block will pass
return true;
}
virtual ISphFilter * Join ( ISphFilter * pFilter );
bool UsesAttrs() const { return m_bUsesAttrs; }
ISphFilter() : m_bUsesAttrs ( true ) {}
protected:
bool m_bUsesAttrs;
};
ISphFilter * sphCreateFilter ( const CSphFilterSettings & tSettings, const ISphSchema & tSchema, const DWORD * pMvaPool, const BYTE * pStrings, CSphString & sError, ESphCollation eCollation, bool bArenaProhibit );
ISphFilter * sphCreateAggrFilter ( const CSphFilterSettings * pSettings, const CSphString & sAttrName, const ISphSchema & tSchema, CSphString & sError );
ISphFilter * sphCreateFilter ( const KillListVector & dKillList );
ISphFilter * sphJoinFilters ( ISphFilter *, ISphFilter * );
#endif // _sphinxfilter_
//
// $Id$
//