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

Jim Lynch jim at fayettedigital.com
Mon Oct 25 02:00:45 BST 2010


On 10/24/2010 07:42 PM, Marinos Yannikos wrote:
> #!/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); 

Try this:

#!/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_database($xa);
$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);

I think it needs to know what database to do the spelling check on.

Jim.




More information about the Xapian-discuss mailing list