1 package Search
::Xapian
::TermGenerator
;
9 our @ISA = qw(DynaLoader);
11 # Preloaded methods go here.
13 # In a new thread, copy objects of this class to unblessed, undef values.
16 use overload
'=' => sub { $_[0]->clone() },
21 my $class = ref( $self );
22 my $copy = new2
( $self );
42 Search::Xapian::TermGenerator - Parses a piece of text and generates terms.
46 This module takes a piece of text and parses it to produce words which are
47 then used to generate suitable terms for indexing. The terms generated
48 are suitable for use with L<Search::Xapian::Query> objects produced by the
49 L<Search::Xapian::QueryParser> class.
55 my $doc = new Search::Xapian::Document();
56 my $tg = new Search::Xapian::TermGenerator();
57 $tg->set_stemmer(new Search::Xapian::Stem("english"));
58 $tg->set_document($doc);
59 $tg->index_text("The cat sat on the mat");
67 TermGenerator constructor.
69 =item set_stemmer <stemmer>
71 Set the L<Search::Xapian::Stem> object to be used for generating stemmed terms.
73 =item set_stopper <stopper>
75 Set the L<Search::Xapian::Stopper> object to be used for identifying stopwords.
77 =item set_document <document>
79 Set the L<Search::Xapian::Document> object to index terms into.
81 =item get_document <document>
83 Get the currently set L<Search::Xapian::Document> object.
85 =item index_text <text> [<wdf_inc> [<prefix>]]
87 Indexes the text in string <text>. The optional parameter <wdf_inc> sets the
88 wdf increment (default 1). The optional parameter <prefix> sets the term
89 prefix to use (default is no prefix).
91 =item index_text_without_positions <text> [<wdf_inc> [<prefix>]]
93 Just like index_text, but no positional information is generated. This means
94 that the database will be significantly smaller, but that phrase searching
95 and NEAR won't be supported.
97 =item increase_termpos [<delta>]
99 Increase the termpos used by index_text by <delta> (default 100).
101 This can be used to prevent phrase searches from spanning two
102 unconnected blocks of text (e.g. the title and body text).
106 Get the current term position.
108 =item set_termpos <termpos>
110 Set the current term position.
112 =item get_description
114 Return a description of this object.
120 https://xapian.org/docs/sourcedoc/html/classXapian_1_1TermGenerator.html