xapian-core  1.4.26
valuestreamdocument.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2009,2011,2014 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (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, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef XAPIAN_INCLUDED_VALUESTREAMDOCUMENT_H
22 #define XAPIAN_INCLUDED_VALUESTREAMDOCUMENT_H
23 
24 #include "backends/document.h"
25 #include "backends/valuelist.h"
26 #include "omassert.h"
27 #include "xapian/database.h"
28 #include "xapian/types.h"
29 
30 #include <map>
31 
35  void operator=(const ValueStreamDocument &);
36 
39 
40  mutable std::map<Xapian::valueno, ValueList *> valuelists;
41 
43 
44  size_t current;
45 
47 
48  public:
49  explicit ValueStreamDocument(const Xapian::Database & db_)
50  : Internal(db_.internal[0], 0), db(db_), current(0), doc(NULL) { }
51 
52  void new_subdb(int n);
53 
55 
57  // did needs to be the document id in the sub-database.
58  size_t multiplier = db.internal.size();
59  did = (did_ - 1) / multiplier + 1;
60  AssertEq(current, (did_ - 1) % multiplier);
61  delete doc;
62  doc = NULL;
63  }
64 
65  // Optimise away the virtual call when the matcher wants to know a value.
66  std::string get_value(Xapian::valueno slot) const {
68  }
69 
70  private:
72  std::string do_get_value(Xapian::valueno slot) const;
73  void do_get_all_values(std::map<Xapian::valueno, std::string> & values_) const;
74  std::string do_get_data() const;
76 };
77 
78 #endif // XAPIAN_INCLUDED_VALUESTREAMDOCUMENT_H
typedefs for Xapian
#define AssertEq(A, B)
Definition: omassert.h:124
Xapian::docid did
The document ID of the document in that database.
Definition: document.h:90
This class is used to access a database, or a group of databases.
Definition: database.h:68
A document which gets its values from a ValueStreamManager.
ValueStreamDocument(const Xapian::Database &db_)
A document in the database, possibly plus modifications.
Definition: document.h:43
ValueStreamDocument(const ValueStreamDocument &)
Don&#39;t allow copying.
void set_document(Xapian::docid did_)
std::vector< Xapian::Internal::intrusive_ptr< Internal > > internal
Definition: database.h:81
std::map< Xapian::valueno, ValueList * > valuelists
Xapian::Document::Internal * doc
API for working with Xapian databases.
std::string do_get_value(Xapian::valueno slot) const
Implementation of virtual methods.
void operator=(const ValueStreamDocument &)
Don&#39;t allow assignment.
std::string get_value(Xapian::valueno slot) const
std::string do_get_data() const
Implementation of virtual methods.
unsigned valueno
The number for a value slot in a document.
Definition: types.h:108
Abstract base class for value streams.
Various assertion macros.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:52
void do_get_all_values(std::map< Xapian::valueno, std::string > &values_) const
Implementation of virtual methods.