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

Jim Lynch jim at fayettedigital.com
Mon Oct 25 18:40:21 BST 2010


Note in http://xapian.org/docs/spelling.html, about 1/3 of the way down 
the page, the sentence, "Note that you must call the set_database() 
method as well as setting FLAG_SPELLING so that Xapian knows where to 
add the spelling dictionary entries."

Not real obvious, however.  I'd like the API to also mention that fact.

Jim.
On 10/24/2010 09:00 PM, Jim Lynch wrote:
> 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.
>
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>




More information about the Xapian-discuss mailing list