Commit 6934738a authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

StorageJanitor: skip search index check of Collections without mimetype

Without mimetype we don't know which search store to look into,
but it also means that the Indexing Agent should not be able to
index it, so there should be no invalid indexed items.

BUG: 379153
parent 0c0c2824
......@@ -716,6 +716,7 @@ void StorageJanitor::findOprhanSearchIndexEntries()
QueryBuilder qb(Collection::tableName(), QueryBuilder::Select);
qb.addSortColumn(Collection::idColumn(), Query::Ascending);
if (!qb.exec()) {
inform("Failed to query collections, skipping test");
......@@ -733,6 +734,12 @@ void StorageJanitor::findOprhanSearchIndexEntries()
QSqlQuery query = qb.query();
while ( {
const qint64 colId = query.value(0).toLongLong();
// Skip virtual collections, they are not indexed
if (query.value(1).toBool()) {
inform(QStringLiteral("Skipping virtual Collection %1").arg(colId));
inform(QStringLiteral("Checking Collection %1 search index...").arg(colId));
SearchRequest req("StorageJanitor");
......@@ -743,6 +750,11 @@ void StorageJanitor::findOprhanSearchIndexEntries()
Collection col;
const auto colMts = col.mimeTypes();
if (colMts.isEmpty()) {
// No mimetypes means we don't know which search store to look into,
// skip it.
for (const auto &mt : colMts) {
mts <<;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment