mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 16:04:06 +00:00
opt: remove fulltext unused logic (#1733)
* opt: remove fulltext unused logic the firstIteration is not used any more
This commit is contained in:
parent
3ca7c39e69
commit
fc3ea0045e
|
@ -259,7 +259,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ QString const & AardDictionary::getDescription()
|
|||
return dictionaryDescription;
|
||||
}
|
||||
|
||||
void AardDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void AardDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -556,8 +556,6 @@ void AardDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Aard: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -414,7 +414,7 @@ void BglDictionary::getArticleText( uint32_t articleAddress, QString & headword,
|
|||
}
|
||||
}
|
||||
|
||||
void BglDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void BglDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -423,8 +423,6 @@ void BglDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( haveFTSIndex() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Bgl: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -435,7 +435,7 @@ QString const & DictdDictionary::getDescription()
|
|||
return dictionaryDescription;
|
||||
}
|
||||
|
||||
void DictdDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void DictdDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -447,8 +447,6 @@ void DictdDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteratio
|
|||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "DictD: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -523,7 +523,7 @@ public:
|
|||
}
|
||||
|
||||
/// Make index for full-text search
|
||||
virtual void makeFTSIndex( QAtomicInt &, bool ) {}
|
||||
virtual void makeFTSIndex( QAtomicInt & ) {}
|
||||
|
||||
/// Set full-text search parameters
|
||||
virtual void setFTSParameters( Config::FullTextSearch const & ) {}
|
||||
|
|
|
@ -229,7 +229,7 @@ public:
|
|||
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -1072,7 +1072,7 @@ QString DslDictionary::getMainFilename()
|
|||
return getDictionaryFilenames()[ 0 ].c_str();
|
||||
}
|
||||
|
||||
void DslDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void DslDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) ) {
|
||||
|
@ -1086,8 +1086,6 @@ void DslDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( !ensureInitDone().empty() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Dsl: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -425,7 +425,7 @@ QString const & EpwingDictionary::getDescription()
|
|||
return dictionaryDescription;
|
||||
}
|
||||
|
||||
void EpwingDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void EpwingDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -435,8 +435,6 @@ void EpwingDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIterati
|
|||
if ( haveFTSIndex() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Epwing: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ public:
|
|||
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ QString GlsDictionary::getMainFilename()
|
|||
return getDictionaryFilenames()[ 0 ].c_str();
|
||||
}
|
||||
|
||||
void GlsDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void GlsDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -558,8 +558,6 @@ void GlsDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Gls: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ void MdxDictionary::doDeferredInit()
|
|||
}
|
||||
}
|
||||
|
||||
void MdxDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void MdxDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -450,8 +450,6 @@ void MdxDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
// if( !ensureInitDone().empty() )
|
||||
// return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "MDict: Building the full-text index for dictionary: %s", getName().c_str() );
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -379,7 +379,7 @@ void SdictDictionary::loadArticle( uint32_t address, string & articleText )
|
|||
articleText.append( "</div>" );
|
||||
}
|
||||
|
||||
void SdictDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void SdictDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -391,8 +391,6 @@ void SdictDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteratio
|
|||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "SDict: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -636,7 +636,7 @@ public:
|
|||
|
||||
quint64 getArticlePos( uint32_t articleNumber );
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -891,7 +891,7 @@ quint64 SlobDictionary::getArticlePos( uint32_t articleNumber )
|
|||
return ( ( (quint64)( entry.binIndex ) ) << 32 ) | entry.itemIndex;
|
||||
}
|
||||
|
||||
void SlobDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void SlobDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -903,8 +903,6 @@ void SlobDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( !ensureInitDone().empty() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Slob: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -1085,7 +1085,7 @@ QString StardictDictionary::getMainFilename()
|
|||
return getDictionaryFilenames()[ 0 ].c_str();
|
||||
}
|
||||
|
||||
void StardictDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void StardictDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -1097,8 +1097,6 @@ void StardictDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstItera
|
|||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Stardict: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ QString XdxfDictionary::getMainFilename()
|
|||
return getDictionaryFilenames()[ 0 ].c_str();
|
||||
}
|
||||
|
||||
void XdxfDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void XdxfDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -381,8 +381,6 @@ void XdxfDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
if ( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Xdxf: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public:
|
|||
getSearchResults( QString const & searchString, int searchMode, bool matchCase, bool ignoreDiacritics ) override;
|
||||
void getArticleText( uint32_t articleAddress, QString & headword, QString & text ) override;
|
||||
|
||||
void makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration ) override;
|
||||
void makeFTSIndex( QAtomicInt & isCancelled ) override;
|
||||
|
||||
void setFTSParameters( Config::FullTextSearch const & fts ) override
|
||||
{
|
||||
|
@ -480,7 +480,7 @@ QString const & ZimDictionary::getDescription()
|
|||
return dictionaryDescription;
|
||||
}
|
||||
|
||||
void ZimDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
void ZimDictionary::makeFTSIndex( QAtomicInt & isCancelled )
|
||||
{
|
||||
if ( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( this ) ) )
|
||||
|
@ -492,9 +492,6 @@ void ZimDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if ( !ensureInitDone().empty() )
|
||||
return;
|
||||
|
||||
if ( firstIteration )
|
||||
return;
|
||||
|
||||
gdDebug( "Zim: Building the full-text index for dictionary: %s\n", getName().c_str() );
|
||||
try {
|
||||
FtsHelpers::makeFTSIndex( this, isCancelled );
|
||||
|
|
|
@ -34,7 +34,7 @@ void Indexing::run()
|
|||
const QString & dictionaryName = QString::fromUtf8( dictionary->getName().c_str() );
|
||||
qDebug() << "[FULLTEXT] checking fts for the dictionary:" << dictionaryName;
|
||||
emit sendNowIndexingName( dictionaryName );
|
||||
dictionary->makeFTSIndex( isCancelled, false );
|
||||
dictionary->makeFTSIndex( isCancelled );
|
||||
} );
|
||||
synchronizer.addFuture( f );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue