Full-text search: Skip some replacements while load article from MDict dictionary

This commit is contained in:
Abs62 2014-04-29 17:55:48 +04:00
parent 052e43e2c3
commit 616babe60e

9
mdx.cc
View file

@ -271,7 +271,7 @@ private:
void doDeferredInit();
/// Loads an article with the given offset, filling the given strings.
void loadArticle( uint32_t offset, string & articleText );
void loadArticle( uint32_t offset, string & articleText, bool noFilter = false );
/// Process resource links (images, audios, etc)
QString & filterResource( QString const & articleId, QString & article );
@ -506,7 +506,7 @@ void MdxDictionary::getArticleText( uint32_t articleAddress, QString & headword,
headword.clear();
string articleText;
loadArticle( articleAddress, articleText );
loadArticle( articleAddress, articleText, true );
text = Html::unescape( QString::fromUtf8( articleText.data(), articleText.size() ) );
}
catch( std::exception &ex )
@ -916,7 +916,7 @@ void MdxDictionary::loadIcon() throw()
dictionaryIconLoaded = true;
}
void MdxDictionary::loadArticle( uint32_t offset, string & articleText )
void MdxDictionary::loadArticle( uint32_t offset, string & articleText, bool noFilter )
{
vector< char > chunk;
Mutex::Lock _( idxMutex );
@ -944,7 +944,8 @@ void MdxDictionary::loadArticle( uint32_t offset, string & articleText )
recordInfo.recordSize );
article = MdictParser::substituteStylesheet( article, styleSheets );
article = filterResource( articleId, article );
if( !noFilter )
article = filterResource( articleId, article );
articleText = string( article.toUtf8().constData() );
}