xapian-core  1.4.30
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 
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
class with document data
A document which gets its values from a ValueStreamManager.
Xapian::Document::Internal * doc
std::string do_get_data() const
Implementation of virtual methods.
std::map< Xapian::valueno, ValueList * > valuelists
void operator=(const ValueStreamDocument &)
Don't allow assignment.
ValueStreamDocument(const Xapian::Database &db_)
void set_document(Xapian::docid did_)
std::string do_get_value(Xapian::valueno slot) const
Implementation of virtual methods.
ValueStreamDocument(const ValueStreamDocument &)
Don't allow copying.
std::string get_value(Xapian::valueno slot) const
void do_get_all_values(std::map< Xapian::valueno, std::string > &values_) const
Implementation of virtual methods.
This class is used to access a database, or a group of databases.
Definition: database.h:68
std::vector< Xapian::Internal::intrusive_ptr< Internal > > internal
Definition: database.h:81
A document in the database, possibly plus modifications.
Definition: document.h:43
Xapian::docid did
The document ID of the document in that database.
Definition: document.h:90
API for working with Xapian databases.
unsigned valueno
The number for a value slot in a document.
Definition: types.h:108
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:52
Various assertion macros.
#define AssertEq(A, B)
Definition: omassert.h:124
typedefs for Xapian
Abstract base class for value streams.