xapian-core  2.0.0
deciderpostlist.cc
Go to the documentation of this file.
1 
4 /* Copyright 2017,2022 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #include <config.h>
22 
23 #include "deciderpostlist.h"
24 
25 #include "omassert.h"
26 #include <xapian/matchdecider.h>
27 
28 using namespace std;
29 
30 bool
32 {
33  // We know that doc holds a ValueStreamDocument.
34  Xapian::Document::Internal* doc_int = doc.internal.get();
35  ValueStreamDocument* vsdoc = static_cast<ValueStreamDocument*>(doc_int);
36 
37  vsdoc->set_shard_document(pl->get_docid());
38 
39  bool decision = (*decider)(doc);
40  if (decision) {
41  ++accepted;
42  } else {
43  ++rejected;
44  }
45  return decision;
46 }
47 
48 string
50 {
51  string desc = "DeciderPostList(";
52  desc += pl->get_description();
53  desc += ')';
54  return desc;
55 }
std::string get_description() const
Return a string description of this object.
bool test_doc()
Test the current with the MatchDecider.
A document which gets its values from a ValueStreamManager.
void set_shard_document(Xapian::docid shard_did)
Abstract base class for a document.
PostList which applies a MatchDecider.
Abstract base class for match deciders.
Various assertion macros.