# 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,2009 Olly Betts
    00007  *
    00008  * This program is free software; you can redistribute it and/or
    00009  * modify it under the terms of the GNU General Public License as
    00010  * published by the Free Software Foundation; either version 2 of the
    00011  * License, or (at your option) any later version.
    00012  *
    00013  * This program is distributed in the hope that it will be useful,
    00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00016  * GNU General Public License for more details.
    00017  *
    00018  * You should have received a copy of the GNU General Public License
    00019  * along with this program; if not, write to the Free Software
    00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
    00021  * USA
    00022  */
    00023
    00024 #ifndef XAPIAN_INCLUDED_DOCUMENT_H
    00025 #define XAPIAN_INCLUDED_DOCUMENT_H
    00026
    00027 #include <string>
    00028
    00029 #include <xapian/base.h>
    00030 #include <xapian/types.h>
    00031 #include <xapian/termiterator.h>
    00032 #include <xapian/visibility.h>
    00033
    00034 namespace Xapian {
    00035
    00036 class ValueIterator;
    00037
    00039 class XAPIAN_VISIBILITY_DEFAULT Document {
    00040     public:
    00041         class Internal;
    00043         Xapian::Internal::RefCntPtr<Internal> internal;
    00044
    00049         explicit Document(Internal *internal_);
    00050
    00054         Document(const Document &other);
    00055
    00059         void operator=(const Document &other);
    00060
    00062         Document();
    00063
    00065         ~Document();
    00066
    00074         std::string get_value(Xapian::valueno valueno) const;
    00075
    00082         void add_value(Xapian::valueno valueno, const std::string &value);
    00083
    00085         void remove_value(Xapian::valueno valueno);
    00086
    00088         void clear_values();
    00089
    00095         std::string get_data() const;
    00096
    00098         void set_data(const std::string &data);
    00099
    00114         void add_posting(const std::string & tname,
    00115                          Xapian::termpos tpos,
    00116                          Xapian::termcount wdfinc = 1);
    00117
    00127         void add_term(const std::string & tname, Xapian::termcount wdfinc = 1);
    00128
    00148         void remove_posting(const std::string & tname,
    00149                             Xapian::termpos tpos,
    00150                             Xapian::termcount wdfdec = 1);
    00151
    00159         void remove_term(const std::string & tname);
    00160
    00162         void clear_terms();
    00163
    00167         Xapian::termcount termlist_count() const;
    00168
    00170         TermIterator termlist_begin() const;
    00171
    00173         TermIterator termlist_end() const {
    00174             return TermIterator(NULL);
    00175         }
    00176
    00178         Xapian::termcount values_count() const;
    00179
    00181         ValueIterator values_begin() const;
    00182
    00184         ValueIterator values_end() const;
    00185
    00195         docid get_docid() const;
    00196
    00198         std::string get_description() const;
    00199 };
    00200
    00201 }
    00202
    00203 #endif // XAPIAN_INCLUDED_DOCUMENT_H