[Xapian-discuss] Term-Flags

double ninive at gmx.at
Sat Dec 29 19:30:21 GMT 2007


Hi Olly

> It is necessary, but the flag is actually called:
>
> Xapian::TermGenerator::FLAG_SPELLING

Thank you very much for you kind answer. The problem, the most simple
down below code fails (MinGW), error message:

InvalidOperationError: WritableDatabase needs exactly one subdatabase

As soon as I remove "term_generator.set_flags( ... )", it works.


#define DBPATH "c:\\temp\\muell\\"
#define DEFAULT_LANGUAGE "de"
int main()
{
    try
    {
        Xapian::WritableDatabase database( DBPATH "xapian", 
Xapian::DB_CREATE_OR_OPEN );
        Xapian::Document document;

        Xapian::TermGenerator term_generator;
        term_generator.set_flags( Xapian::TermGenerator::FLAG_SPELLING );
        Xapian::Stem stemmer( DEFAULT_LANGUAGE );
        term_generator.set_stemmer( stemmer );
        term_generator.set_document( document );
        term_generator.index_text( "this is a very simple test", 1, "" );

        database.add_document( document );
    }
    catch( const Xapian::Error &error )
    {
        printf( "%s", error.get_description().c_str () );
        return 1;
    }
    return 0;
}




More information about the Xapian-discuss mailing list