diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-06-19 11:04:17 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-19 11:10:47 +0200 |
commit | 077e3cb30ace5f6ee20ee15e0d32d2bfb197fde0 (patch) | |
tree | 3cfdaf0912ef22dba71755b4332354d579f6e7cf /common/resourcefacade.cpp | |
parent | 1ff4456e5dc2b9a9dfa80047f9e5a4a9e1395cdf (diff) | |
download | sink-077e3cb30ace5f6ee20ee15e0d32d2bfb197fde0.tar.gz sink-077e3cb30ace5f6ee20ee15e0d32d2bfb197fde0.zip |
Implement Overlap queries
Summary:
Notes:
- Introduces the concept of queries on multiple properties (which meant changing query's internals a bit)
- Dates are stored as well as the "reference" in the index to allow quick filtering without fetching the whole entity
- Buckets are weeks starting on Monday (guaranteed by the use of the Julian calendar)
- Some size improvements are definitely possible (dates are padded numbers again, not using integer databases, Julian calendar starts at a very old date, etc.)
Test Plan: Tested in querytest
Reviewers: cmollekopf
Reviewed By: cmollekopf
Tags: #sink
Differential Revision: https://phabricator.kde.org/D13477
Diffstat (limited to 'common/resourcefacade.cpp')
-rw-r--r-- | common/resourcefacade.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 7998692..90194d4 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -80,13 +80,13 @@ typename ApplicationDomain::SinkResource::Ptr readFromConfig<ApplicationDomain:: | |||
80 | return object; | 80 | return object; |
81 | } | 81 | } |
82 | 82 | ||
83 | static bool matchesFilter(const QHash<QByteArray, Query::Comparator> &filter, const ApplicationDomain::ApplicationDomainType &entity) | 83 | static bool matchesFilter(const QHash<QByteArrayList, Query::Comparator> &filter, const ApplicationDomain::ApplicationDomainType &entity) |
84 | { | 84 | { |
85 | for (const auto &filterProperty : filter.keys()) { | 85 | for (const auto &filterProperty : filter.keys()) { |
86 | if (filterProperty == ApplicationDomain::SinkResource::ResourceType::name) { | 86 | if (filterProperty[0] == ApplicationDomain::SinkResource::ResourceType::name) { |
87 | continue; | 87 | continue; |
88 | } | 88 | } |
89 | if (!filter.value(filterProperty).matches(entity.getProperty(filterProperty))) { | 89 | if (!filter.value(filterProperty).matches(entity.getProperty(filterProperty[0]))) { |
90 | return false; | 90 | return false; |
91 | } | 91 | } |
92 | } | 92 | } |
@@ -432,7 +432,7 @@ KAsync::Job<void> AccountFacade::remove(const Sink::ApplicationDomain::SinkAccou | |||
432 | //Remove all identities | 432 | //Remove all identities |
433 | job = job.then(Store::fetch<Identity>(Sink::Query{}.filter<Identity::Account>(account))) | 433 | job = job.then(Store::fetch<Identity>(Sink::Query{}.filter<Identity::Account>(account))) |
434 | .each([] (const Identity::Ptr &identity) { return Store::remove(*identity); }); | 434 | .each([] (const Identity::Ptr &identity) { return Store::remove(*identity); }); |
435 | 435 | ||
436 | return job.then(LocalStorageFacade<Sink::ApplicationDomain::SinkAccount>::remove(account)); | 436 | return job.then(LocalStorageFacade<Sink::ApplicationDomain::SinkAccount>::remove(account)); |
437 | } | 437 | } |
438 | 438 | ||