summaryrefslogtreecommitdiffstats
path: root/common/typeindex.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-09-23 01:35:13 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-09-23 01:35:13 +0200
commit52ad48c8bd755a2fde249296d6017853538f478f (patch)
treed3adbee13e49d2525720069cb7d9ca6b5876dbd8 /common/typeindex.cpp
parent6fc76bc690e5a2e7748936fa835338d820c7e7de (diff)
downloadsink-52ad48c8bd755a2fde249296d6017853538f478f.tar.gz
sink-52ad48c8bd755a2fde249296d6017853538f478f.zip
A new query system
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r--common/typeindex.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp
index b96c5b5..1b04966 100644
--- a/common/typeindex.cpp
+++ b/common/typeindex.cpp
@@ -87,7 +87,7 @@ template <>
87void TypeIndex::addProperty<QDateTime>(const QByteArray &property) 87void TypeIndex::addProperty<QDateTime>(const QByteArray &property)
88{ 88{
89 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::Transaction &transaction) { 89 auto indexer = [this, property](const QByteArray &identifier, const QVariant &value, Sink::Storage::Transaction &transaction) {
90 // SinkTrace() << "Indexing " << mType + ".index." + property << date.toString(); 90 //SinkTrace() << "Indexing " << mType + ".index." + property << getByteArray(value);
91 Index(indexName(property), transaction).add(getByteArray(value), identifier); 91 Index(indexName(property), transaction).add(getByteArray(value), identifier);
92 }; 92 };
93 mIndexer.insert(property, indexer); 93 mIndexer.insert(property, indexer);
@@ -138,7 +138,7 @@ void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDoma
138 } 138 }
139} 139}
140 140
141ResultSet TypeIndex::query(const Sink::Query &query, QSet<QByteArray> &appliedFilters, QByteArray &appliedSorting, Sink::Storage::Transaction &transaction) 141QVector<QByteArray> TypeIndex::query(const Sink::Query &query, QSet<QByteArray> &appliedFilters, QByteArray &appliedSorting, Sink::Storage::Transaction &transaction)
142{ 142{
143 QVector<QByteArray> keys; 143 QVector<QByteArray> keys;
144 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) { 144 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) {
@@ -151,7 +151,7 @@ ResultSet TypeIndex::query(const Sink::Query &query, QSet<QByteArray> &appliedFi
151 appliedFilters << it.key(); 151 appliedFilters << it.key();
152 appliedSorting = it.value(); 152 appliedSorting = it.value();
153 SinkTrace() << "Index lookup on " << it.key() << it.value() << " found " << keys.size() << " keys."; 153 SinkTrace() << "Index lookup on " << it.key() << it.value() << " found " << keys.size() << " keys.";
154 return ResultSet(keys); 154 return keys;
155 } 155 }
156 } 156 }
157 for (const auto &property : mProperties) { 157 for (const auto &property : mProperties) {
@@ -162,9 +162,9 @@ ResultSet TypeIndex::query(const Sink::Query &query, QSet<QByteArray> &appliedFi
162 lookupKey, [&](const QByteArray &value) { keys << value; }, [property](const Index::Error &error) { SinkWarning() << "Error in index: " << error.message << property; }); 162 lookupKey, [&](const QByteArray &value) { keys << value; }, [property](const Index::Error &error) { SinkWarning() << "Error in index: " << error.message << property; });
163 appliedFilters << property; 163 appliedFilters << property;
164 SinkTrace() << "Index lookup on " << property << " found " << keys.size() << " keys."; 164 SinkTrace() << "Index lookup on " << property << " found " << keys.size() << " keys.";
165 return ResultSet(keys); 165 return keys;
166 } 166 }
167 } 167 }
168 SinkTrace() << "No matching index"; 168 SinkTrace() << "No matching index";
169 return ResultSet(keys); 169 return keys;
170} 170}