Changeset View
Changeset View
Standalone View
Standalone View
src/file/firstrunindexer.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
43 | { | 43 | { | ||
44 | Q_ASSERT(m_config->isInitialRun()); | 44 | Q_ASSERT(m_config->isInitialRun()); | ||
45 | { | 45 | { | ||
46 | Transaction tr(m_db, Transaction::ReadOnly); | 46 | Transaction tr(m_db, Transaction::ReadOnly); | ||
47 | Q_ASSERT_X(tr.size() == 0, "FirstRunIndexer", "The database is not empty on first run"); | 47 | Q_ASSERT_X(tr.size() == 0, "FirstRunIndexer", "The database is not empty on first run"); | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | QMimeDatabase mimeDb; | 50 | QMimeDatabase mimeDb; | ||
51 | BasicIndexingJob::IndexingLevel level = m_config->onlyBasicIndexing() ? BasicIndexingJob::NoLevel | ||||
52 | : BasicIndexingJob::MarkForContentIndexing; | ||||
51 | 53 | | |||
52 | for (const QString& folder : qAsConst(m_folders)) { | 54 | for (const QString& folder : qAsConst(m_folders)) { | ||
53 | Transaction tr(m_db, Transaction::ReadWrite); | 55 | Transaction tr(m_db, Transaction::ReadWrite); | ||
54 | 56 | | |||
55 | FilteredDirIterator it(m_config, folder); | 57 | FilteredDirIterator it(m_config, folder); | ||
56 | while (!it.next().isEmpty()) { | 58 | while (!it.next().isEmpty()) { | ||
57 | QString mimetype = mimeDb.mimeTypeForFile(it.filePath(), QMimeDatabase::MatchExtension).name(); | 59 | QString mimetype = mimeDb.mimeTypeForFile(it.filePath(), QMimeDatabase::MatchExtension).name(); | ||
58 | if (!m_config->shouldMimeTypeBeIndexed(mimetype)) { | 60 | if (!m_config->shouldMimeTypeBeIndexed(mimetype)) { | ||
59 | continue; | 61 | continue; | ||
60 | } | 62 | } | ||
61 | BasicIndexingJob::IndexingLevel level = | 63 | | ||
62 | m_config->onlyBasicIndexing() ? BasicIndexingJob::NoLevel : BasicIndexingJob::MarkForContentIndexing; | | |||
63 | BasicIndexingJob job(it.filePath(), mimetype, level); | 64 | BasicIndexingJob job(it.filePath(), mimetype, level); | ||
64 | if (!job.index()) { | 65 | if (!job.index()) { | ||
65 | continue; | 66 | continue; | ||
66 | } | 67 | } | ||
67 | 68 | | |||
68 | // Even though this is the first run, because 2 hard links will resolve to the same id, | 69 | // Even though this is the first run, because 2 hard links will resolve to the same id, | ||
69 | // we land up crashing (due to the asserts in addDocument). | 70 | // we land up crashing (due to the asserts in addDocument). | ||
70 | // Hence we are checking before. | 71 | // Hence we are checking before. | ||
Show All 17 Lines |