- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# include/xapian/termgenerator.h

Go to the documentation of this file.

    00001
    00004 /* Copyright (C) 2007 Olly Betts
    00005  *
    00006  * This program is free software; you can redistribute it and/or modify
    00007  * it under the terms of the GNU General Public License as published by
    00008  * the Free Software Foundation; either version 2 of the License, or
    00009  * (at your option) any later version.
    00010  *
    00011  * This program is distributed in the hope that it will be useful,
    00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014  * GNU General Public License for more details.
    00015  *
    00016  * You should have received a copy of the GNU General Public License
    00017  * along with this program; if not, write to the Free Software
    00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    00019  */
    00020
    00021 #ifndef XAPIAN_INCLUDED_TERMGENERATOR_H
    00022 #define XAPIAN_INCLUDED_TERMGENERATOR_H
    00023
    00024 #include <xapian/base.h>
    00025 #include <xapian/types.h>
    00026 #include <xapian/unicode.h>
    00027 #include <xapian/visibility.h>
    00028
    00029 #include <string>
    00030
    00031 namespace Xapian {
    00032
    00033 class Document;
    00034 class Stem;
    00035 class Stopper;
    00036 class WritableDatabase;
    00037
    00044 class XAPIAN_VISIBILITY_DEFAULT TermGenerator {
    00045   public:
    00047     class Internal;
    00049     Xapian::Internal::RefCntPtr<Internal> internal;
    00050
    00052     TermGenerator(const TermGenerator & o);
    00053
    00055     TermGenerator & operator=(const TermGenerator & o);
    00056
    00058     TermGenerator();
    00059
    00061     ~TermGenerator();
    00062
    00064     void set_stemmer(const Xapian::Stem & stemmer);
    00065
    00067     void set_stopper(const Xapian::Stopper *stop = NULL);
    00068
    00070     void set_document(const Xapian::Document & doc);
    00071
    00073     const Xapian::Document & get_document() const;
    00074
    00076     void set_database(const Xapian::WritableDatabase &db);
    00077
    00079     enum flags {
    00081         FLAG_SPELLING = 128 // Value matches QueryParser flag.
    00082     };
    00083
    00096     flags set_flags(flags toggle, flags mask = flags(0));
    00097
    00103     void index_text(const Xapian::Utf8Iterator & itor,
    00104                     Xapian::termcount weight = 1,
    00105                     const std::string & prefix = "");
    00106
    00112     void index_text(const std::string & text,
    00113                     Xapian::termcount weight = 1,
    00114                     const std::string & prefix = "") {
    00115         return index_text(Utf8Iterator(text), weight, prefix);
    00116     }
    00117
    00124     void index_text_without_positions(const Xapian::Utf8Iterator & itor,
    00125                                       Xapian::termcount weight = 1,
    00126                                       const std::string & prefix = "");
    00127
    00134     void index_text_without_positions(const std::string & text,
    00135                                       Xapian::termcount weight = 1,
    00136                                       const std::string & prefix = "") {
    00137         return index_text_without_positions(Utf8Iterator(text), weight, prefix);
    00138     }
    00139
    00145     void increase_termpos(Xapian::termcount delta = 100);
    00146
    00148     Xapian::termcount get_termpos() const;
    00149
    00151     void set_termpos(Xapian::termcount termpos);
    00152
    00154     std::string get_description() const;
    00155 };
    00156
    00157 }
    00158
    00159 #endif // XAPIAN_INCLUDED_TERMGENERATOR_H