logic: fixed missing matches in fulltext search

This commit is contained in:
mlangkabel
2018-04-24 19:18:26 +02:00
parent bac9f7fbc4
commit d29cabd0b3
4 changed files with 27 additions and 17 deletions
+23 -13
View File
@@ -2787,22 +2787,32 @@ void PersistentStorage::buildFullTextSearchIndex() const
m_fullTextSearchIndex.clear();
std::vector<std::shared_ptr<std::thread>> threads;
for (std::vector<StorageFile> part : utility::splitToEqualySizedParts(m_sqliteIndexStorage.getAll<StorageFile>(), utility::getIdealThreadCount()))
{
std::shared_ptr<std::thread> thread = std::make_shared<std::thread>(
[&](const std::vector<StorageFile>& files)
std::vector<StorageFile> indexedFiles;
for (const StorageFile& file : m_sqliteIndexStorage.getAll<StorageFile>())
{
if (file.indexed)
{
for (const StorageFile& file : files)
indexedFiles.push_back(file);
}
}
for (std::vector<StorageFile> part : utility::splitToEqualySizedParts(indexedFiles, utility::getIdealThreadCount()))
{
std::shared_ptr<std::thread> thread = std::make_shared<std::thread>(
[&](const std::vector<StorageFile>& files)
{
m_fullTextSearchIndex.addFile(
file.id,
codec.decode(m_sqliteIndexStorage.getFileContentById(file.id)->getText())
);
}
},
part
);
threads.push_back(thread);
for (const StorageFile& file : files)
{
m_fullTextSearchIndex.addFile(
file.id,
codec.decode(m_sqliteIndexStorage.getFileContentById(file.id)->getText())
);
}
},
part
);
threads.push_back(thread);
}
}
for (std::shared_ptr<std::thread> thread : threads)
{