Hello community, here is the log from the commit of package akonadi-search for openSUSE:Factory checked in at 2016-11-12 13:27:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/akonadi-search (Old) and /work/SRC/openSUSE:Factory/.akonadi-search.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "akonadi-search" Changes: -------- --- /work/SRC/openSUSE:Factory/akonadi-search/akonadi-search.changes 2016-10-18 10:10:32.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.akonadi-search.new/akonadi-search.changes 2016-11-12 13:27:25.000000000 +0100 @@ -1,0 +2,7 @@ +Wed Nov 9 06:08:04 UTC 2016 - [email protected] + +- Update to KDE Applications 16.08.3 + * KDE Applications 16.08.3 + * https://www.kde.org/announcements/announce-applications-16.08.3.php + +------------------------------------------------------------------- Old: ---- akonadi-search-16.08.2.tar.xz New: ---- akonadi-search-16.08.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ akonadi-search.spec ++++++ --- /var/tmp/diff_new_pack.5RWfSb/_old 2016-11-12 13:27:26.000000000 +0100 +++ /var/tmp/diff_new_pack.5RWfSb/_new 2016-11-12 13:27:26.000000000 +0100 @@ -17,7 +17,7 @@ Name: akonadi-search -Version: 16.08.2 +Version: 16.08.3 Release: 0 Summary: Framework for searching and managing PIM metadata License: GPL-2.0+ and LGPL-2.1+ and LGPL-3.0 ++++++ akonadi-search-16.08.2.tar.xz -> akonadi-search-16.08.3.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/CMakeLists.txt new/akonadi-search-16.08.3/CMakeLists.txt --- old/akonadi-search-16.08.2/CMakeLists.txt 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/CMakeLists.txt 2016-10-16 15:29:59.000000000 +0200 @@ -20,15 +20,15 @@ include(ECMQtDeclareLoggingCategory) -set(PIM_VERSION "5.3.2") +set(PIM_VERSION "5.3.3") set(AKONADISEARCH_VERSION ${PIM_VERSION}) -set(AKONADI_VERSION "5.3.2") -set(AKONADI_MIMELIB_VERSION "5.3.2") -set(KCONTACTS_LIB_VERSION "5.3.2") -set(KCALENDARCORE_LIB_VERSION "5.3.2") -set(KMIME_LIB_VERSION "5.3.2") +set(AKONADI_VERSION "5.3.3") +set(AKONADI_MIMELIB_VERSION "5.3.3") +set(KCONTACTS_LIB_VERSION "5.3.3") +set(KCALENDARCORE_LIB_VERSION "5.3.3") +set(KMIME_LIB_VERSION "5.3.3") find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Test) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/agent/agent.cpp new/akonadi-search-16.08.3/agent/agent.cpp --- old/akonadi-search-16.08.2/agent/agent.cpp 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/agent/agent.cpp 2016-10-16 15:29:59.000000000 +0200 @@ -36,6 +36,8 @@ #include <AkonadiCore/CollectionFetchScope> #include <AkonadiCore/ItemFetchScope> #include <AkonadiCore/EntityDisplayAttribute> +#include <AkonadiCore/IndexPolicyAttribute> +#include <AkonadiCore/AttributeFactory> #include <AgentManager> #include <ServerManager> @@ -57,6 +59,8 @@ lowerSchedulingPriority(); lowerPriority(); + Akonadi::AttributeFactory::registerAttribute<Akonadi::IndexPolicyAttribute>(); + // TODO: Migrate from baloorc to custom config file KConfig config(QStringLiteral("baloorc")); KConfigGroup group = config.group("Akonadi"); @@ -87,6 +91,8 @@ changeRecorder()->itemFetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent); changeRecorder()->itemFetchScope().setFetchRemoteIdentification(false); changeRecorder()->itemFetchScope().setFetchModificationTime(false); + changeRecorder()->itemFetchScope().fetchFullPayload(true); + changeRecorder()->collectionFetchScope().fetchAttribute<Akonadi::IndexPolicyAttribute>(); changeRecorder()->collectionFetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::All); changeRecorder()->collectionFetchScope().ancestorFetchScope().fetchAttribute<Akonadi::EntityDisplayAttribute>(); changeRecorder()->collectionFetchScope().setListFilter(Akonadi::CollectionFetchScope::Index); @@ -145,12 +151,19 @@ void AkonadiIndexingAgent::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection) { - Q_UNUSED(collection); + if (!shouldIndex(collection)) { + return; + } + m_scheduler.addItem(item); } void AkonadiIndexingAgent::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers) { + if (!shouldIndex(item)) { + return; + } + // We don't index certain parts so we don't care when they change QSet<QByteArray> pi = partIdentifiers; QMutableSetIterator<QByteArray> it(pi); @@ -171,6 +184,14 @@ const QSet<QByteArray> &addedFlags, const QSet<QByteArray> &removedFlags) { + // We optimize and skip the "shouldIndex" call for each item here, since it's + // cheaper to just let Xapian throw an exception for items that were not + // indexed. + // In most cases the entire batch comes from the same collection, so we will + // only suffer penalty in case of larger batches from non-indexed collections, + // but we assume that that's a much less common case than collections with + // indexing enabled. + // Akonadi always sends batch of items of the same type m_index.updateFlags(items, addedFlags, removedFlags); m_index.scheduleCommit(); @@ -178,6 +199,10 @@ void AkonadiIndexingAgent::itemsRemoved(const Akonadi::Item::List &items) { + // We optimize and skip the "shouldIndex" call for each item here, since it's + // cheaper to just let Xapian throw an exception for items that were not + // indexed instead of filtering the list here. + m_index.remove(items); m_index.scheduleCommit(); } @@ -186,14 +211,34 @@ const Akonadi::Collection &sourceCollection, const Akonadi::Collection &destinationCollection) { - m_index.move(items, sourceCollection, destinationCollection); - m_index.scheduleCommit(); + const bool indexSource = shouldIndex(sourceCollection); + const bool indexDest = shouldIndex(destinationCollection); + + if (indexSource && indexDest) { + m_index.move(items, sourceCollection, destinationCollection); + m_index.scheduleCommit(); + } else if (!indexSource && indexDest) { + for (const auto &item : items) { + m_scheduler.addItem(item); + } + m_index.scheduleCommit(); + } else if (indexSource && !indexDest) { + m_index.remove(items); + m_index.scheduleCommit(); + } else { + // nothing to do + } } void AkonadiIndexingAgent::collectionAdded(const Akonadi::Collection &collection, const Akonadi::Collection &parent) { Q_UNUSED(parent); + + if (!shouldIndex(collection)) { + return; + } + m_index.index(collection); m_index.scheduleCommit(); } @@ -201,6 +246,19 @@ void AkonadiIndexingAgent::collectionChanged(const Akonadi::Collection &collection, const QSet<QByteArray> &changedAttributes) { + if (changedAttributes.contains(Akonadi::IndexPolicyAttribute().type())) { + const auto attr = collection.attribute<Akonadi::IndexPolicyAttribute>(); + if (attr && !attr->indexingEnabled()) { + // The indexing attribute has changed and is now disabled: remove + // collection and all indexed items + m_index.remove(collection); + } else { + // The indexing attribute has changed and is now missing or enabled, + // schedule full collection sync. + m_scheduler.scheduleCollection(collection, true); + } + } + QSet<QByteArray> changes = changedAttributes; changes.remove("collectionquota"); changes.remove("timestamp"); @@ -222,6 +280,9 @@ void AkonadiIndexingAgent::collectionRemoved(const Akonadi::Collection &collection) { + // We intentionally don't call "shouldIndex" here to make absolutely sure + // that all items are wiped from the index + m_index.remove(collection); m_index.scheduleCommit(); } @@ -233,6 +294,10 @@ Q_UNUSED(collectionSource); Q_UNUSED(collectionDestination); + if (!shouldIndex(collection)) { + return; + } + m_index.remove(collection); CollectionUpdateJob *job = new CollectionUpdateJob(m_index, collection, this); job->start(); @@ -280,4 +345,16 @@ } } +bool AkonadiIndexingAgent::shouldIndex(const Akonadi::Collection &col) const +{ + return !col.isVirtual() + && (!col.hasAttribute<Akonadi::IndexPolicyAttribute>() + || col.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled()); +} + +bool AkonadiIndexingAgent::shouldIndex(const Akonadi::Item &item) const +{ + return shouldIndex(item.parentCollection()); +} + AKONADI_AGENT_MAIN(AkonadiIndexingAgent) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/agent/agent.h new/akonadi-search-16.08.3/agent/agent.h --- old/akonadi-search-16.08.2/agent/agent.h 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/agent/agent.h 2016-10-16 15:29:59.000000000 +0200 @@ -80,6 +80,9 @@ void onOnlineChanged(bool online); private: + bool shouldIndex(const Akonadi::Item &item) const; + bool shouldIndex(const Akonadi::Collection &collection) const; + Index m_index; Scheduler m_scheduler; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/agent/collectionindexingjob.cpp new/akonadi-search-16.08.3/agent/collectionindexingjob.cpp --- old/akonadi-search-16.08.2/agent/collectionindexingjob.cpp 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/agent/collectionindexingjob.cpp 2016-10-16 15:29:59.000000000 +0200 @@ -28,6 +28,7 @@ #include <AkonadiCore/CollectionFetchScope> #include <AkonadiCore/ServerManager> #include <AkonadiCore/CollectionStatistics> +#include <AkonadiCore/IndexPolicyAttribute> #include <KLocalizedString> CollectionIndexingJob::CollectionIndexingJob(Index &index, const Akonadi::Collection &col, @@ -58,6 +59,7 @@ Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(m_collection, Akonadi::CollectionFetchJob::Base); job->fetchScope().setIncludeStatistics(true); job->fetchScope().setListFilter(Akonadi::CollectionFetchScope::NoFilter); + job->fetchScope().fetchAttribute<Akonadi::IndexPolicyAttribute>(); connect(job, &KJob::finished, this, &CollectionIndexingJob::slotOnCollectionFetched); job->start(); } @@ -71,6 +73,14 @@ return; } m_collection = static_cast<Akonadi::CollectionFetchJob *>(job)->collections().at(0); + if (m_collection.isVirtual() + || (m_collection.hasAttribute<Akonadi::IndexPolicyAttribute>() + && !m_collection.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled())) + { + emitResult(); + return; + } + Q_EMIT status(Akonadi::AgentBase::Running, i18n("Indexing collection: %1", m_collection.displayName())); Q_EMIT percent(0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/agent/collectionupdatejob.cpp new/akonadi-search-16.08.3/agent/collectionupdatejob.cpp --- old/akonadi-search-16.08.2/agent/collectionupdatejob.cpp 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/agent/collectionupdatejob.cpp 2016-10-16 15:29:59.000000000 +0200 @@ -25,6 +25,7 @@ #include <AkonadiCore/CollectionFetchJob> #include <AkonadiCore/CollectionFetchScope> #include <AkonadiCore/EntityDisplayAttribute> +#include <AkonadiCore/IndexPolicyAttribute> CollectionUpdateJob::CollectionUpdateJob(Index &index, const Akonadi::Collection &col, QObject *parent) : KJob(parent), @@ -36,13 +37,16 @@ void CollectionUpdateJob::start() { - mIndex.change(mCol); + if (shouldIndex(mCol)) { + mIndex.change(mCol); + } //Fetch children to update the path accordingly Akonadi::CollectionFetchJob *fetchJob = new Akonadi::CollectionFetchJob(mCol, Akonadi::CollectionFetchJob::Recursive, this); fetchJob->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::All); fetchJob->fetchScope().ancestorFetchScope().fetchAttribute<Akonadi::EntityDisplayAttribute>(); fetchJob->fetchScope().setListFilter(Akonadi::CollectionFetchScope::NoFilter); + fetchJob->fetchScope().fetchAttribute<Akonadi::IndexPolicyAttribute>(); connect(fetchJob, &Akonadi::CollectionFetchJob::collectionsReceived, this, &CollectionUpdateJob::onCollectionsReceived); connect(fetchJob, &KJob::result, this, &CollectionUpdateJob::onCollectionsFetched); } @@ -51,7 +55,9 @@ { //Required to update the path Q_FOREACH (const Akonadi::Collection &child, list) { - mIndex.change(child); + if (shouldIndex(mCol)) { + mIndex.change(child); + } } } @@ -63,3 +69,9 @@ emitResult(); } +bool CollectionUpdateJob::shouldIndex(const Akonadi::Collection &col) const +{ + return !col.isVirtual() + && (!mCol.hasAttribute<Akonadi::IndexPolicyAttribute>() + || mCol.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled()); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/agent/collectionupdatejob.h new/akonadi-search-16.08.3/agent/collectionupdatejob.h --- old/akonadi-search-16.08.2/agent/collectionupdatejob.h 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/agent/collectionupdatejob.h 2016-10-16 15:29:59.000000000 +0200 @@ -43,6 +43,8 @@ void onCollectionsFetched(KJob *); private: + bool shouldIndex(const Akonadi::Collection &col) const; + Akonadi::Collection mCol; Index &mIndex; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-search-16.08.2/agent/scheduler.cpp new/akonadi-search-16.08.3/agent/scheduler.cpp --- old/akonadi-search-16.08.2/agent/scheduler.cpp 2016-10-10 00:52:24.000000000 +0200 +++ new/akonadi-search-16.08.3/agent/scheduler.cpp 2016-10-16 15:29:59.000000000 +0200 @@ -26,6 +26,7 @@ #include <AkonadiCore/CollectionFetchScope> #include <AkonadiAgentBase/AgentBase> #include <AkonadiCore/ServerManager> +#include <AkonadiCore/IndexPolicyAttribute> #include <KLocalizedString> #include <KConfigGroup> #include <QTimer> @@ -141,6 +142,7 @@ Akonadi::CollectionFetchJob::Recursive); job->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::All); job->fetchScope().setListFilter(Akonadi::CollectionFetchScope::Index); + job->fetchScope().fetchAttribute<Akonadi::IndexPolicyAttribute>(); connect(job, &KJob::finished, this, &Scheduler::slotRootCollectionsFetched); job->start(); } @@ -151,6 +153,7 @@ Akonadi::CollectionFetchJob::Recursive); job->fetchScope().setAncestorRetrieval(Akonadi::CollectionFetchScope::All); job->fetchScope().setListFilter(Akonadi::CollectionFetchScope::NoFilter); + job->fetchScope().setListFilter(Akonadi::CollectionFetchScope::Index); connect(job, &KJob::finished, this, &Scheduler::slotCollectionsToIndexFetched); job->start(); } @@ -167,6 +170,10 @@ if (c == Akonadi::Collection::root()) { continue; } + if (c.hasAttribute<Akonadi::IndexPolicyAttribute>() && + !c.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled()) { + continue; + } scheduleCollection(c, true); } @@ -188,6 +195,10 @@ if (c == Akonadi::Collection::root()) { continue; } + if (c.hasAttribute<Akonadi::IndexPolicyAttribute>() && + !c.attribute<Akonadi::IndexPolicyAttribute>()->indexingEnabled()) { + continue; + } m_index.index(c); } }
