diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 583f78f4..d45cb9e3 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -1651,7 +1651,7 @@ void GraphController::groupTrailNodes(GroupType groupType) groupNode->groupLayout = GroupLayout::SKEWED; // Use token Id of first node and make first 2 bits 1 - groupNode->tokenId = ~(~size_t(0) >> 2) + node.nodeId; + groupNode->tokenId = ~(~Id(0) >> 2) + node.nodeId; m_topLevelAncestorIds[groupNode->tokenId] = groupNode->tokenId; std::shared_ptr targetEdge = std::make_shared(); diff --git a/src/lib/data/fulltextsearch/SuffixArray.cpp b/src/lib/data/fulltextsearch/SuffixArray.cpp index 9a3510a9..a16924ab 100644 --- a/src/lib/data/fulltextsearch/SuffixArray.cpp +++ b/src/lib/data/fulltextsearch/SuffixArray.cpp @@ -9,7 +9,7 @@ struct suffix int rank[2]; }; -int SuffixArray::cmp(struct suffix a, struct suffix b) +int SuffixArray::cmp(const struct suffix& a, const struct suffix& b) { return (a.rank[0] == b.rank[0]) ? (a.rank[1] < b.rank[1] ? 1 : 0) : (a.rank[0] < b.rank[0] ? 1 : 0); } @@ -105,7 +105,7 @@ std::vector SuffixArray::searchForTerm(const std::wstring& searchTerm) cons { matches.push_back(m_array[lower]); } - for (int higher = m+1; higher < termLength && m_lcp[higher-1] >= termLength; higher++) + for (int higher = m+1; higher < m_text.length() && m_lcp[higher-1] >= termLength; higher++) { matches.push_back(m_array[higher]); } diff --git a/src/lib/data/fulltextsearch/SuffixArray.h b/src/lib/data/fulltextsearch/SuffixArray.h index bd5d36b5..68a4c204 100644 --- a/src/lib/data/fulltextsearch/SuffixArray.h +++ b/src/lib/data/fulltextsearch/SuffixArray.h @@ -10,7 +10,7 @@ class SuffixArray public: SuffixArray(const std::wstring& text); std::vector searchForTerm(const std::wstring& searchTerm) const; - static int cmp(struct suffix a, struct suffix b); + static int cmp(const struct suffix& a, const struct suffix& b); void printArray() const; void printLCP() const; diff --git a/src/lib/data/storage/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp index 9884dfbd..76d6383e 100644 --- a/src/lib/data/storage/PersistentStorage.cpp +++ b/src/lib/data/storage/PersistentStorage.cpp @@ -2787,22 +2787,32 @@ void PersistentStorage::buildFullTextSearchIndex() const m_fullTextSearchIndex.clear(); std::vector> threads; - for (std::vector part : utility::splitToEqualySizedParts(m_sqliteIndexStorage.getAll(), utility::getIdealThreadCount())) { - std::shared_ptr thread = std::make_shared( - [&](const std::vector& files) + std::vector indexedFiles; + for (const StorageFile& file : m_sqliteIndexStorage.getAll()) + { + if (file.indexed) { - for (const StorageFile& file : files) + indexedFiles.push_back(file); + } + } + for (std::vector part : utility::splitToEqualySizedParts(indexedFiles, utility::getIdealThreadCount())) + { + std::shared_ptr thread = std::make_shared( + [&](const std::vector& 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 thread : threads) {