mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
xapian revert the needToRebuildBTreeIndex to needToRebuildIndex
This commit is contained in:
parent
c930687055
commit
df0622d216
|
@ -589,51 +589,6 @@ string getFtsSuffix(){
|
|||
#endif
|
||||
}
|
||||
|
||||
bool needToRebuildBTreeIndex( vector< string > const & dictionaryFiles,
|
||||
string const & indexFile ) noexcept
|
||||
{
|
||||
unsigned long lastModified = 0;
|
||||
|
||||
for( std::vector< string >::const_iterator i = dictionaryFiles.begin();
|
||||
i != dictionaryFiles.end(); ++i )
|
||||
{
|
||||
QString name = FsEncoding::decode( i->c_str() );
|
||||
QFileInfo fileInfo( name );
|
||||
unsigned long ts;
|
||||
|
||||
if( fileInfo.isDir() )
|
||||
continue;
|
||||
|
||||
if( name.toLower().endsWith( ".zip" ) )
|
||||
{
|
||||
ZipFile::SplitZipFile zf( name );
|
||||
if( !zf.exists() )
|
||||
return true;
|
||||
ts = zf.lastModified().toSecsSinceEpoch();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !fileInfo.exists() )
|
||||
return true;
|
||||
ts = fileInfo.lastModified().toSecsSinceEpoch();
|
||||
}
|
||||
|
||||
if ( ts > lastModified )
|
||||
lastModified = ts;
|
||||
}
|
||||
|
||||
QDir d(FsEncoding::decode( indexFile.c_str() ));
|
||||
if(d.exists()){
|
||||
d.removeRecursively();
|
||||
}
|
||||
QFileInfo fileInfo( FsEncoding::decode( indexFile.c_str() ) );
|
||||
|
||||
if ( !fileInfo.exists() )
|
||||
return true;
|
||||
|
||||
return fileInfo.lastModified().toSecsSinceEpoch() < lastModified;
|
||||
}
|
||||
|
||||
QString generateRandomDictionaryId()
|
||||
{
|
||||
return QString(
|
||||
|
|
|
@ -497,8 +497,6 @@ string makeDictionaryId( vector< string > const & dictionaryFiles ) noexcept;
|
|||
bool needToRebuildIndex( vector< string > const & dictionaryFiles,
|
||||
string const & indexFile ) noexcept;
|
||||
|
||||
bool needToRebuildBTreeIndex( vector< string > const & dictionaryFiles,
|
||||
string const & indexFile ) noexcept;
|
||||
string getFtsSuffix();
|
||||
/// Returns a random dictionary id useful for interactively created
|
||||
/// dictionaries.
|
||||
|
|
2
dsl.cc
2
dsl.cc
|
@ -1943,7 +1943,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
string indexFile = indicesDir + dictId;
|
||||
|
||||
if ( Dictionary::needToRebuildBTreeIndex( dictFiles, indexFile ) ||
|
||||
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) ||
|
||||
indexIsOldOrBad( indexFile, zipFileName.size() ) )
|
||||
{
|
||||
DslScanner scanner( *i );
|
||||
|
|
2
mdx.cc
2
mdx.cc
|
@ -1401,7 +1401,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
|
|||
string dictId = Dictionary::makeDictionaryId( dictFiles );
|
||||
string indexFile = indicesDir + dictId;
|
||||
|
||||
if ( Dictionary::needToRebuildBTreeIndex( dictFiles, indexFile ) ||
|
||||
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) ||
|
||||
indexIsOldOrBad( dictFiles, indexFile ) )
|
||||
{
|
||||
// Building the index
|
||||
|
|
2
zim.cc
2
zim.cc
|
@ -1545,7 +1545,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
try
|
||||
{
|
||||
if ( Dictionary::needToRebuildBTreeIndex( dictFiles, indexFile ) ||
|
||||
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) ||
|
||||
indexIsOldOrBad( indexFile ) )
|
||||
{
|
||||
gdDebug( "Zim: Building the index for dictionary: %s\n", i->c_str() );
|
||||
|
|
Loading…
Reference in a new issue