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");
https://xapian.org/docs/sourcedoc/html/classXapian_1_1TermGenerator.html