00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OM_HGUARD_DOCUMENT_H
00024 #define OM_HGUARD_DOCUMENT_H
00025
00026 #include <xapian/base.h>
00027 #include <xapian/types.h>
00028 #include "termlist.h"
00029 #include "database.h"
00030 #include "documentterm.h"
00031 #include <map>
00032 #include <string>
00033
00034 using namespace std;
00035
00037 class Xapian::Document::Internal : public Xapian::Internal::RefCntBase {
00038 friend class Xapian::ValueIterator;
00039 public:
00041 typedef map<Xapian::valueno, string> document_values;
00042
00044 typedef map<string, OmDocumentTerm> document_terms;
00045
00046 private:
00047
00048 Internal(const Internal &);
00049 Internal & operator=(const Internal &);
00050
00052 const Xapian::Database::Internal *database;
00053
00054 bool data_here;
00055 mutable bool values_here;
00056 mutable bool terms_here;
00057
00059 string data;
00060
00062 mutable document_values values;
00063
00065 mutable vector<Xapian::valueno> value_nos;
00066
00068 mutable document_terms terms;
00069
00070 protected:
00076 Xapian::docid did;
00077
00078 private:
00079
00080 virtual string do_get_value(Xapian::valueno ) const { return ""; }
00081 virtual map<Xapian::valueno, string> do_get_all_values() const {
00082 map<Xapian::valueno, string> none;
00083 return none;
00084 }
00085 virtual string do_get_data() const { return ""; }
00086
00087 public:
00104 string get_value(Xapian::valueno valueid) const;
00105
00106 Xapian::valueno values_count() const;
00107 void add_value(Xapian::valueno, const string &);
00108 void remove_value(Xapian::valueno);
00109 void clear_values();
00110 void add_posting(const string &, Xapian::termpos, Xapian::termcount);
00111 void add_term(const string &, Xapian::termcount);
00112 void remove_posting(const string &, Xapian::termpos, Xapian::termcount);
00113 void remove_term(const string &);
00114 void clear_terms();
00115 Xapian::termcount termlist_count() const;
00116
00130 string get_data() const;
00131
00132 void set_data(const string &);
00133
00142 TermList * open_term_list() const;
00143
00144 void need_values() const;
00145 void need_terms() const;
00146
00156 Xapian::docid get_docid() const { return did; }
00157
00159 string get_description() const;
00160
00166 Internal(const Xapian::Database::Internal *database_, Xapian::docid did_)
00167 : database(database_), data_here(false), values_here(false),
00168 terms_here(false), did(did_) { }
00169
00170 Internal()
00171 : database(0), data_here(false), values_here(false),
00172 terms_here(false) { }
00173
00179 virtual ~Internal() { }
00180 };
00181
00182 #endif // OM_HGUARD_DOCUMENT_H