Some more unhandled exceptions in index search

This commit is contained in:
Abs62 2013-09-18 17:58:38 +04:00
parent 8607af8d90
commit 7d167aedf8

View file

@ -80,26 +80,39 @@ vector< WordArticleLink > BtreeIndex::findArticles( wstring const & str )
{
vector< WordArticleLink > result;
wstring folded = Folding::apply( str );
if( folded.empty() )
folded = Folding::applyWhitespaceOnly( str );
bool exactMatch;
vector< char > leaf;
uint32_t nextLeaf;
char const * leafEnd;
char const * chainOffset = findChainOffsetExactOrPrefix( folded, exactMatch,
leaf, nextLeaf,
leafEnd );
if ( chainOffset && exactMatch )
try
{
result = readChain( chainOffset );
wstring folded = Folding::apply( str );
if( folded.empty() )
folded = Folding::applyWhitespaceOnly( str );
antialias( str, result );
bool exactMatch;
vector< char > leaf;
uint32_t nextLeaf;
char const * leafEnd;
char const * chainOffset = findChainOffsetExactOrPrefix( folded, exactMatch,
leaf, nextLeaf,
leafEnd );
if ( chainOffset && exactMatch )
{
result = readChain( chainOffset );
antialias( str, result );
}
}
catch( std::exception & e )
{
FDPRINTF( stderr, "Articles searching failed, error: %s\n", e.what() );
result.clear();
}
catch(...)
{
FDPRINTF( stderr, "Articles searching failed\n" );
result.clear();
}
return result;