use Search::Xapian::WritableDatabase;
use Search::Xapian;

my $stemmer=Search::Xapian::Stem->new("english");

my $db=Search::Xapian::WritableDatabase->new("foo", Search::Xapian::DB_CREATE_OR_OPEN);
for (1..10000) {
	my $pageterm="U:$_\n";
	my $doc=Search::Xapian::Document->new();
	$doc->set_data(
		"url=foo\n".
		"sample=foo($_)oobar($_)baz\n".
		"modtime=".localtime(time)."\n"
	);
	my $tg = Search::Xapian::TermGenerator->new();
	$tg->set_stemmer($stemmer);
	$tg->set_document($doc);
	$tg->index_text("$_ $_$_", 2);
	$tg->index_text("foo$_", 1, "XLINK");
	$doc->add_term($pageterm);
	$db->replace_document_by_term($pageterm, $doc);
}
