xapian-core  1.4.21
valuesetmatchdecider.h
Go to the documentation of this file.
1 
4 /* Copyright 2008 Lemur Consulting Ltd
5  * Copyright 2008,2009,2011,2013,2014 Olly Betts
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22 
23 #ifndef XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H
24 #define XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H
25 
26 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
27 # error Never use <xapian/valuesetmatchdecider.h> directly; include <xapian.h> instead.
28 #endif
29 
30 #include <xapian/enquire.h>
31 #include <xapian/types.h>
32 #include <xapian/visibility.h>
33 
34 #include <string>
35 #include <set>
36 
37 namespace Xapian {
38 
39 class Document;
40 
46  std::set<std::string> testset;
47 
50 
56  bool inclusive;
57 
58  public:
68  ValueSetMatchDecider(Xapian::valueno slot, bool inclusive_)
69  : valuenum(slot), inclusive(inclusive_) { }
70 
75  void add_value(const std::string& value)
76  {
77  testset.insert(value);
78  }
79 
84  void remove_value(const std::string& value)
85  {
86  testset.erase(value);
87  }
88 
95  bool operator()(const Xapian::Document& doc) const;
96 };
97 
98 }
99 
100 #endif /* XAPIAN_INCLUDED_VALUESETMATCHDECIDER_H */
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
MatchDecider filtering results based on whether document values are in a user-defined set...
typedefs for Xapian
void remove_value(const std::string &value)
Remove a value from the test set.
void add_value(const std::string &value)
Add a value to the test set.
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28
API for running queries.
valueno valuenum
The value slot to look in.
std::set< std::string > testset
Set of values to test for.
Define XAPIAN_VISIBILITY_* macros.
Base class for matcher decision functor.
Definition: enquire.h:118
unsigned valueno
The number for a value slot in a document.
Definition: types.h:108
A handle representing a document in a Xapian database.
Definition: document.h:61
bool inclusive
Whether to include or exclude documents with the specified values.
ValueSetMatchDecider(Xapian::valueno slot, bool inclusive_)
Construct a ValueSetMatchDecider.