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
00074 void set_stopper(const Xapian::Stopper *stop = NULL);
00075
00077 void set_document(const Xapian::Document & doc);
00078
00080 const Xapian::Document & get_document() const;
00081
00083 void set_database(const Xapian::WritableDatabase &db);
00084
00086 enum flags {
00088 FLAG_SPELLING = 128
00089 };
00090
00103 flags set_flags(flags toggle, flags mask = flags(0));
00104
00111 void index_text(const Xapian::Utf8Iterator & itor,
00112 Xapian::termcount wdf_inc = 1,
00113 const std::string & prefix = std::string());
00114
00121 void index_text(const std::string & text,
00122 Xapian::termcount wdf_inc = 1,
00123 const std::string & prefix = std::string()) {
00124 return index_text(Utf8Iterator(text), wdf_inc, prefix);
00125 }
00126
00137 void index_text_without_positions(const Xapian::Utf8Iterator & itor,
00138 Xapian::termcount wdf_inc = 1,
00139 const std::string & prefix = std::string());
00140
00151 void index_text_without_positions(const std::string & text,
00152 Xapian::termcount wdf_inc = 1,
00153 const std::string & prefix = std::string()) {
00154 return index_text_without_positions(Utf8Iterator(text), wdf_inc, prefix);
00155 }
00156
00165 void increase_termpos(Xapian::termcount delta = 100);
00166
00168 Xapian::termcount get_termpos() const;
00169
00174 void set_termpos(Xapian::termcount termpos);
00175
00177 std::string get_description() const;
00178 };
00179
00180 }
00181
00182 #endif // XAPIAN_INCLUDED_TERMGENERATOR_H