[Xapian-discuss] Cannot index with dynamic spelling data (Perl/Search::Xapian)

Marinos Yannikos mjy at pobox.com
Mon Oct 25 00:42:09 BST 2010


This is my test case, what am I doing wrong? It seems that the API is used 
incorrectly, but I cannot find the problem...

--- 8< ---
#!/usr/bin/perl

use Search::Xapian qw(:all);
use strict;

my $xa = new Search::Xapian::WritableDatabase ("/tmp/xapian",
            DB_CREATE_OR_OVERWRITE);

my $indexer = Search::Xapian::TermGenerator->new();
$indexer->set_flags(Search::Xapian::FLAG_SPELLING);

my $doc = new Search::Xapian::Document;
$indexer->set_document($doc);
$indexer->index_text("hello 123 blah blah");

$xa->add_document($doc);
--- >8 ---

Output:

terminate called after throwing an instance of 'Xapian::InvalidOperationError'
Aborted

It works fine without "$indexer->set_flags(Search::Xapian::FLAG_SPELLING);", but 
then spelling correction does not work. The error/exception occurs at 
index_text(). I've tried with/without stemmer, it makes no difference.

xapian-core version is 1.2.3, Search::Xapian is 1.2.3.0. Perl5.10 (Debian Lenny).

Thanks,
  Marinos



More information about the Xapian-discuss mailing list