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
00071 void set_stopper(const Xapian::Stopper *stop = NULL);
00072
00074 void set_document(const Xapian::Document & doc);
00075
00077 const Xapian::Document & get_document() const;
00078
00080 void set_database(const Xapian::WritableDatabase &db);
00081
00083 enum flags {
00085 FLAG_SPELLING = 128
00086 };
00087
00100 flags set_flags(flags toggle, flags mask = flags(0));
00101
00107 void index_text(const Xapian::Utf8Iterator & itor,
00108 Xapian::termcount weight = 1,
00109 const std::string & prefix = "");
00110
00116 void index_text(const std::string & text,
00117 Xapian::termcount weight = 1,
00118 const std::string & prefix = "") {
00119 return index_text(Utf8Iterator(text), weight, prefix);
00120 }
00121
00128 void index_text_without_positions(const Xapian::Utf8Iterator & itor,
00129 Xapian::termcount weight = 1,
00130 const std::string & prefix = "");
00131
00138 void index_text_without_positions(const std::string & text,
00139 Xapian::termcount weight = 1,
00140 const std::string & prefix = "") {
00141 return index_text_without_positions(Utf8Iterator(text), weight, prefix);
00142 }
00143
00149 void increase_termpos(Xapian::termcount delta = 100);
00150
00152 Xapian::termcount get_termpos() const;
00153
00155 void set_termpos(Xapian::termcount termpos);
00156
00158 std::string get_description() const;
00159 };
00160
00161 }
00162
00163 #endif // XAPIAN_INCLUDED_TERMGENERATOR_H