# include/xapian/document.h

Go to the documentation of this file.

    00001
    00004 /* ----START-LICENCE----
    00005  * Copyright 1999,2000,2001 BrightStation PLC
    00006  * Copyright 2002 Ananova Ltd
    00007  * Copyright 2002,2003,2004 Olly Betts
    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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00022  * USA
    00023  * -----END-LICENCE-----
    00024  */
    00025
    00026 #ifndef XAPIAN_INCLUDED_DOCUMENT_H
    00027 #define XAPIAN_INCLUDED_DOCUMENT_H
    00028
    00029 #include <string>
    00030
    00031 #include <xapian/base.h>
    00032 #include <xapian/types.h>
    00033
    00034 namespace Xapian {
    00035
    00036 class TermIterator;
    00037 class ValueIterator;
    00038
    00040 class Document {
    00041     public:
    00042         class Internal;
    00044         Xapian::Internal::RefCntPtr<Internal> internal;
    00045
    00050         explicit Document(Internal *internal_);
    00051
    00055         Document(const Document &other);
    00056
    00060         void operator=(const Document &other);
    00061
    00063         Document();
    00064
    00066         ~Document();
    00067
    00069         std::string get_value(Xapian::valueno value) const;
    00070
    00074         void add_value(Xapian::valueno valueno, const std::string &value);
    00075
    00077         void remove_value(Xapian::valueno valueno);
    00078
    00080         void clear_values();
    00081
    00087         std::string get_data() const;
    00088
    00090         void set_data(const std::string &data);
    00091
    00106         void add_posting(const std::string & tname,
    00107                          Xapian::termpos tpos,
    00108                          Xapian::termcount wdfinc = 1);
    00109
    00119         void add_term(const std::string & tname, Xapian::termcount wdfinc = 1);
    00120
    00126         void add_term_nopos(const std::string & term,
    00127                             Xapian::termcount wdfinc = 1) {
    00128             add_term(term, wdfinc);
    00129         }
    00130
    00150         void remove_posting(const std::string & tname,
    00151                             Xapian::termpos tpos,
    00152                             Xapian::termcount wdfdec = 1);
    00153
    00161         void remove_term(const std::string & tname);
    00162
    00164         void clear_terms();
    00165
    00167         Xapian::termcount termlist_count() const;
    00168
    00170         TermIterator termlist_begin() const;
    00171
    00173         TermIterator termlist_end() const;
    00174
    00176         Xapian::termcount values_count() const;
    00177
    00179         ValueIterator values_begin() const;
    00180
    00182         ValueIterator values_end() const;
    00183
    00188         std::string get_description() const;
    00189 };
    00190
    00191 }
    00192
    00193 #endif // XAPIAN_INCLUDED_DOCUMENT_H