int main() { int A[] = { 1, 3, 1 }; int a = hIndex(A, 3); }
ISphTokenizer * sphConfTokenizer ( const CSphConfigSection & hIndex, CSphString & sError ) { // charset_type CSphScopedPtr<ISphTokenizer> pTokenizer ( NULL ); if ( !hIndex("charset_type") || hIndex["charset_type"]=="sbcs" ) { pTokenizer = sphCreateSBCSTokenizer (); } else if ( hIndex["charset_type"]=="utf-8" ) { pTokenizer = hIndex("ngram_chars") ? sphCreateUTF8NgramTokenizer () : sphCreateUTF8Tokenizer (); } else { sError.SetSprintf ( "unknown charset type '%s'", hIndex["charset_type"].cstr() ); return NULL; } assert ( pTokenizer.Ptr() ); // charset_table if ( hIndex("charset_table") ) if ( !pTokenizer->SetCaseFolding ( hIndex["charset_table"].cstr(), sError ) ) { sError.SetSprintf ( "'charset_table': %s", sError.cstr() ); return NULL; } // min_word_len int iMinWordLen = hIndex("min_word_len") ? Max ( hIndex["min_word_len"].intval(), 0 ) : 0; if ( iMinWordLen ) pTokenizer->SetMinWordLen ( iMinWordLen ); // ngram_chars if ( hIndex("ngram_chars") ) if ( !pTokenizer->SetNgramChars ( hIndex["ngram_chars"].cstr(), sError ) ) { sError.SetSprintf ( "'ngram_chars': %s", sError.cstr() ); return NULL; } // ngram_len int iNgramLen = hIndex("ngram_len") ? Max ( hIndex["ngram_len"].intval(), 0 ) : 0; if ( iNgramLen ) pTokenizer->SetNgramLen ( iNgramLen ); // synonyms CSphVariant * pExceptions = hIndex("exceptions"); // new option name if ( !pExceptions ) pExceptions = hIndex("synonyms"); // deprecated option name if ( pExceptions ) if ( !pTokenizer->LoadSynonyms ( pExceptions->cstr(), sError ) ) { sError.SetSprintf ( "'exceptions': %s", sError.cstr() ); return NULL; } // phrase boundaries int iBoundaryStep = hIndex("phrase_boundary_step") ? Max ( hIndex["phrase_boundary_step"].intval(), 0 ) : 0; if ( iBoundaryStep>0 && hIndex("phrase_boundary") ) if ( !pTokenizer->SetBoundary ( hIndex["phrase_boundary"].cstr(), sError ) ) { sError.SetSprintf ( "'phrase_boundary': %s", sError.cstr() ); return NULL; } // ignore_chars if ( hIndex("ignore_chars") ) if ( !pTokenizer->SetIgnoreChars ( hIndex["ignore_chars"].cstr(), sError ) ) { sError.SetSprintf ( "'ignore_chars': %s", sError.cstr() ); return NULL; } return pTokenizer.LeakPtr(); }