mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
opt: boost slob fulltext speed
and reduce the impact to normal query when create slob fulltext index
🎨 apply clang-format changes
This commit is contained in:
parent
d9c16a2f86
commit
40c890b5ca
|
@ -1088,26 +1088,7 @@ quint64 SlobDictionary::getArticlePos( uint32_t articleNumber )
|
||||||
|
|
||||||
void SlobDictionary::sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets, QAtomicInt & isCancelled )
|
void SlobDictionary::sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets, QAtomicInt & isCancelled )
|
||||||
{
|
{
|
||||||
QVector< uint32_t > newOffsets;
|
//Currently , we use xapian to create the fulltext index. The order of offsets is no important.
|
||||||
newOffsets.reserve( offsets.size() );
|
|
||||||
|
|
||||||
{
|
|
||||||
QMutexLocker _( &slobMutex );
|
|
||||||
|
|
||||||
SlobFile::RefOffsetsVector const & sortedOffsets = sf.getSortedRefOffsets();
|
|
||||||
|
|
||||||
qint32 entries = sf.getRefsCount();
|
|
||||||
for ( qint32 i = 0; i < entries; i++ ) {
|
|
||||||
if ( Utils::AtomicInt::loadAcquire( isCancelled ) )
|
|
||||||
throw exUserAbort();
|
|
||||||
if ( offsets.contains( sortedOffsets[ i ].second ) )
|
|
||||||
newOffsets.append( sortedOffsets[ i ].second );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
offsets.reserve( newOffsets.size() );
|
|
||||||
for ( int i = 0; i < newOffsets.size(); i++ )
|
|
||||||
offsets[ i ] = newOffsets.at( i );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlobDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
void SlobDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||||
|
|
Loading…
Reference in a new issue