summaryrefslogtreecommitdiffstats
path: root/common/query.cpp
diff options
context:
space:
mode:
authorRémi Nicole <nicole@kolabsystems.com>2018-06-19 11:04:17 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-06-19 11:10:47 +0200
commit077e3cb30ace5f6ee20ee15e0d32d2bfb197fde0 (patch)
tree3cfdaf0912ef22dba71755b4332354d579f6e7cf /common/query.cpp
parent1ff4456e5dc2b9a9dfa80047f9e5a4a9e1395cdf (diff)
downloadsink-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/query.cpp')
-rw-r--r--common/query.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/query.cpp b/common/query.cpp
index 404a304..ceb1897 100644
--- a/common/query.cpp
+++ b/common/query.cpp
@@ -179,6 +179,19 @@ bool QueryBase::Comparator::matches(const QVariant &v) const
179 179
180 return range[0] <= v && v <= range[1]; 180 return range[0] <= v && v <= range[1];
181 } 181 }
182 case Overlap: {
183 auto bounds = value.value<QList<QVariant>>();
184 if (bounds.size() < 2) {
185 return false;
186 }
187
188 auto range = v.value<QList<QVariant>>();
189 if (range.size() < 2) {
190 return false;
191 }
192
193 return range[0] <= bounds[1] && bounds[0] <= range[1];
194 }
182 case Fulltext: 195 case Fulltext:
183 case Invalid: 196 case Invalid:
184 default: 197 default: