From 6076ad4747b32087da47e4a809bf6e70a4bcee98 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 27 Dec 2015 13:03:12 +0100 Subject: Properly index dates --- common/typeindex.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common/typeindex.cpp') diff --git a/common/typeindex.cpp b/common/typeindex.cpp index e9a0f79..19e0507 100644 --- a/common/typeindex.cpp +++ b/common/typeindex.cpp @@ -20,6 +20,7 @@ #include "log.h" #include "index.h" +#include TypeIndex::TypeIndex(const QByteArray &type) : mType(type) @@ -61,9 +62,10 @@ template<> void TypeIndex::addProperty(const QByteArray &property) { auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Akonadi2::Storage::Transaction &transaction) { - // Trace() << "Indexing " << mType + ".index." + property << value.toByteArray(); - if (value.isValid()) { - Index(mType + ".index." + property, transaction).add(value.toByteArray(), identifier); + const auto date = value.toDateTime(); + // Trace() << "Indexing " << mType + ".index." + property << date.toString(); + if (date.isValid()) { + Index(mType + ".index." + property, transaction).add(date.toString().toLatin1(), identifier); } }; mIndexer.insert(property, indexer); -- cgit v1.2.3