diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-27 13:03:12 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-27 13:03:12 +0100 |
commit | 6076ad4747b32087da47e4a809bf6e70a4bcee98 (patch) | |
tree | 35d58854380109baebc753af33632d8f4ddbda83 /common/typeindex.cpp | |
parent | 3df975bd9cd244cb941a3ce5068924ef3a05df4f (diff) | |
download | sink-6076ad4747b32087da47e4a809bf6e70a4bcee98.tar.gz sink-6076ad4747b32087da47e4a809bf6e70a4bcee98.zip |
Properly index dates
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r-- | common/typeindex.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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 @@ | |||
20 | 20 | ||
21 | #include "log.h" | 21 | #include "log.h" |
22 | #include "index.h" | 22 | #include "index.h" |
23 | #include <QDateTime> | ||
23 | 24 | ||
24 | TypeIndex::TypeIndex(const QByteArray &type) | 25 | TypeIndex::TypeIndex(const QByteArray &type) |
25 | : mType(type) | 26 | : mType(type) |
@@ -61,9 +62,10 @@ template<> | |||
61 | void TypeIndex::addProperty<QDateTime>(const QByteArray &property) | 62 | void TypeIndex::addProperty<QDateTime>(const QByteArray &property) |
62 | { | 63 | { |
63 | auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Akonadi2::Storage::Transaction &transaction) { | 64 | auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Akonadi2::Storage::Transaction &transaction) { |
64 | // Trace() << "Indexing " << mType + ".index." + property << value.toByteArray(); | 65 | const auto date = value.toDateTime(); |
65 | if (value.isValid()) { | 66 | // Trace() << "Indexing " << mType + ".index." + property << date.toString(); |
66 | Index(mType + ".index." + property, transaction).add(value.toByteArray(), identifier); | 67 | if (date.isValid()) { |
68 | Index(mType + ".index." + property, transaction).add(date.toString().toLatin1(), identifier); | ||
67 | } | 69 | } |
68 | }; | 70 | }; |
69 | mIndexer.insert(property, indexer); | 71 | mIndexer.insert(property, indexer); |