Xapian::TermGenerator(3) User Contributed Perl Documentation Xapian::TermGenerator(3)

Search::Xapian::TermGenerator - Parses a piece of text and generates terms.

This module takes a piece of text and parses it to produce words which are then used to generate suitable terms for indexing. The terms generated are suitable for use with Search::Xapian::Query objects produced by the Search::Xapian::QueryParser class.

use Search::Xapian;
my $doc = new Search::Xapian::Document();
my $tg = new Search::Xapian::TermGenerator();
$tg->set_stemmer(new Search::Xapian::Stem("english"));
$tg->set_document($doc);
$tg->index_text("The cat sat on the mat");

TermGenerator constructor.
Set the Search::Xapian::Stem object to be used for generating stemmed terms.
Set the Search::Xapian::Stopper object to be used for identifying stopwords.
Set the Search::Xapian::Document object to index terms into.
Get the currently set Search::Xapian::Document object.
Indexes the text in string <text>. The optional parameter <wdf_inc> sets the wdf increment (default 1). The optional parameter <prefix> sets the term prefix to use (default is no prefix).
Just like index_text, but no positional information is generated. This means that the database will be significantly smaller, but that phrase searching and NEAR won't be supported.
Increase the termpos used by index_text by <delta> (default 100).

This can be used to prevent phrase searches from spanning two unconnected blocks of text (e.g. the title and body text).

Get the current term position.
Set the current term position.
Return a description of this object.

https://xapian.org/docs/sourcedoc/html/classXapian_1_1TermGenerator.html
2024-09-01 perl v5.40.0