www.xapian.org -> xapian.org
[xapian.git] / xapian-bindings / perl / Xapian / TermGenerator.pm
blob81e1d5fe5e714b9f0e283bdb7a46b9b95d86b10e
1 package Xapian::TermGenerator;
3 =head1 NAME
5 Xapian::TermGenerator - Parses a piece of text and generates terms.
7 =head1 DESCRIPTION
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.
14 =head1 SYNOPSIS
16 use Xapian;
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");
24 =head1 METHODS
26 =over 4
28 =item new
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).
67 =item get_termpos
69 Get the current term position.
71 =item set_termpos <termpos>
73 Set the current term position.
75 =item get_description
77 Return a description of this object.
79 =back
81 =head1 REFERENCE
83 http://xapian.org/docs/sourcedoc/html/classXapian_1_1TermGenerator.html
85 =cut