00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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