1 package Xapian
::TermGenerator
;
5 Xapian::TermGenerator - Parses a piece of text and generates terms.
9 This module takes a piece of text and parses it to produce words which are
10 then used to generate suitable terms for indexing. The terms generated
11 are suitable for use with L<Xapian::Query> objects produced by the
12 L<Xapian::QueryParser> class.
18 my $doc = new Xapian::Document();
19 my $tg = new Xapian::TermGenerator();
20 $tg->set_stemmer(new Xapian::Stem("english"));
21 $tg->set_document($doc);
22 $tg->index_text("The cat sat on the mat");
30 TermGenerator constructor.
32 =item set_stemmer <stemmer>
34 Set the L<Xapian::Stem> object to be used for generating stemmed terms.
36 =item set_stopper <stopper>
38 Set the L<Xapian::Stopper> object to be used for identifying stopwords.
40 =item set_document <document>
42 Set the L<Xapian::Document> object to index terms into.
44 =item get_document <document>
46 Get the currently set L<Xapian::Document> object.
48 =item index_text <text> [<wdf_inc> [<prefix>]]
50 Indexes the text in string <text>. The optional parameter <wdf_inc> sets the
51 wdf increment (default 1). The optional parameter <prefix> sets the term
52 prefix to use (default is no prefix).
54 =item index_text_without_positions <text> [<wdf_inc> [<prefix>]]
56 Just like index_text, but no positional information is generated. This means
57 that the database will be significantly smaller, but that phrase searching
58 and NEAR won't be supported.
60 =item increase_termpos [<delta>]
62 Increase the termpos used by index_text by <delta> (default 100).
64 This can be used to prevent phrase searches from spanning two
65 unconnected blocks of text (e.g. the title and body text).
69 Get the current term position.
71 =item set_termpos <termpos>
73 Set the current term position.
77 Return a description of this object.
83 https://xapian.org/docs/sourcedoc/html/classXapian_1_1TermGenerator.html