include/xapian/document.h

Go to the documentation of this file.
00001 
00004 /* Copyright 1999,2000,2001 BrightStation PLC
00005  * Copyright 2002 Ananova Ltd
00006  * Copyright 2002,2003,2004,2006,2007 Olly Betts
00007  * Copyright 2009 Lemur Consulting Ltd
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License as
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef XAPIAN_INCLUDED_DOCUMENT_H
00026 #define XAPIAN_INCLUDED_DOCUMENT_H
00027 
00028 #include <string>
00029 
00030 #include <xapian/base.h>
00031 #include <xapian/types.h>
00032 #include <xapian/termiterator.h>
00033 #include <xapian/valueiterator.h>
00034 #include <xapian/visibility.h>
00035 
00036 namespace Xapian {
00037 
00038 class ValueIterator;
00039 
00041 class XAPIAN_VISIBILITY_DEFAULT Document {
00042     public:
00043         class Internal;
00045         Xapian::Internal::RefCntPtr<Internal> internal;
00046 
00051         explicit Document(Internal *internal_);
00052 
00056         Document(const Document &other);
00057 
00061         void operator=(const Document &other);
00062 
00064         Document();
00065 
00067         ~Document();
00068 
00076         std::string get_value(Xapian::valueno valueno) const;
00077 
00081         void add_value(Xapian::valueno valueno, const std::string &value);
00082 
00084         void remove_value(Xapian::valueno valueno);
00085 
00087         void clear_values();
00088 
00094         std::string get_data() const;
00095 
00097         void set_data(const std::string &data);
00098 
00113         void add_posting(const std::string & tname,
00114                          Xapian::termpos tpos,
00115                          Xapian::termcount wdfinc = 1);
00116 
00126         void add_term(const std::string & tname, Xapian::termcount wdfinc = 1);
00127 
00147         void remove_posting(const std::string & tname,
00148                             Xapian::termpos tpos,
00149                             Xapian::termcount wdfdec = 1);
00150 
00158         void remove_term(const std::string & tname);
00159 
00161         void clear_terms();
00162 
00166         Xapian::termcount termlist_count() const;
00167 
00169         TermIterator termlist_begin() const;
00170 
00172         TermIterator termlist_end() const {
00173             return TermIterator(NULL);
00174         }
00175 
00177         Xapian::termcount values_count() const;
00178 
00180         ValueIterator values_begin() const;
00181 
00183         ValueIterator values_end() const {
00184             return ValueIterator();
00185         }
00186 
00196         docid get_docid() const;
00197 
00205         std::string serialise() const;
00206 
00209         static Document unserialise(const std::string &s);
00210 
00212         std::string get_description() const;
00213 };
00214 
00215 }
00216 
00217 #endif // XAPIAN_INCLUDED_DOCUMENT_H

Documentation for Xapian (version 1.1.0).
Generated on 22 Apr 2009 by Doxygen 1.5.2.