diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-07-27 13:37:32 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-27 13:47:54 +0200 |
commit | 0a9b39a1f58c1f5b1a424acbe369db520a12df42 (patch) | |
tree | 4c64e5680150f50088bf114cbab39f79f781d242 /common/typeindex.cpp | |
parent | 620c4f551d3de830a516475ad02965695cb25945 (diff) | |
download | sink-0a9b39a1f58c1f5b1a424acbe369db520a12df42.tar.gz sink-0a9b39a1f58c1f5b1a424acbe369db520a12df42.zip |
Use Key API in DataStoreQuery
Reviewers: cmollekopf
Reviewed By: cmollekopf
Tags: #sink
Differential Revision: https://phabricator.kde.org/D14099
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r-- | common/typeindex.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp index 887a146..1dd54e8 100644 --- a/common/typeindex.cpp +++ b/common/typeindex.cpp | |||
@@ -427,17 +427,17 @@ QVector<QByteArray> TypeIndex::query(const Sink::QueryBase &query, QSet<QByteArr | |||
427 | return {}; | 427 | return {}; |
428 | } | 428 | } |
429 | 429 | ||
430 | QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant &value, | 430 | QVector<Identifier> TypeIndex::lookup(const QByteArray &property, const QVariant &value, |
431 | Sink::Storage::DataStore::Transaction &transaction) | 431 | Sink::Storage::DataStore::Transaction &transaction) |
432 | { | 432 | { |
433 | SinkTraceCtx(mLogCtx) << "Index lookup on property: " << property << mSecondaryProperties.keys() << mProperties; | 433 | SinkTraceCtx(mLogCtx) << "Index lookup on property: " << property << mSecondaryProperties.keys() << mProperties; |
434 | if (mProperties.contains(property)) { | 434 | if (mProperties.contains(property)) { |
435 | QVector<QByteArray> keys; | 435 | QVector<Identifier> keys; |
436 | Index index(indexName(property), transaction); | 436 | Index index(indexName(property), transaction); |
437 | const auto lookupKey = getByteArray(value); | 437 | const auto lookupKey = getByteArray(value); |
438 | index.lookup(lookupKey, | 438 | index.lookup(lookupKey, |
439 | [&](const QByteArray &value) { | 439 | [&](const QByteArray &value) { |
440 | keys << Identifier::fromInternalByteArray(value).toDisplayByteArray(); | 440 | keys << Identifier::fromInternalByteArray(value); |
441 | }, | 441 | }, |
442 | [property](const Index::Error &error) { | 442 | [property](const Index::Error &error) { |
443 | SinkWarning() << "Error in index: " << error.message << property; | 443 | SinkWarning() << "Error in index: " << error.message << property; |
@@ -447,7 +447,7 @@ QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant | |||
447 | } else if (mSecondaryProperties.contains(property)) { | 447 | } else if (mSecondaryProperties.contains(property)) { |
448 | // Lookups on secondary indexes first lookup the key, and then lookup the results again to | 448 | // Lookups on secondary indexes first lookup the key, and then lookup the results again to |
449 | // resolve to entity id's | 449 | // resolve to entity id's |
450 | QVector<QByteArray> keys; | 450 | QVector<Identifier> keys; |
451 | auto resultProperty = mSecondaryProperties.value(property); | 451 | auto resultProperty = mSecondaryProperties.value(property); |
452 | 452 | ||
453 | QVector<QByteArray> secondaryKeys; | 453 | QVector<QByteArray> secondaryKeys; |
@@ -466,7 +466,7 @@ QVector<QByteArray> TypeIndex::lookup(const QByteArray &property, const QVariant | |||
466 | } else { | 466 | } else { |
467 | SinkWarning() << "Tried to lookup " << property << " but couldn't find value"; | 467 | SinkWarning() << "Tried to lookup " << property << " but couldn't find value"; |
468 | } | 468 | } |
469 | return QVector<QByteArray>(); | 469 | return {}; |
470 | } | 470 | } |
471 | 471 | ||
472 | template <> | 472 | template <> |