diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-01 16:22:55 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-01 16:22:55 +0200 |
commit | 096d14f20f4dc39d20d35d605ca755b66bd48cf9 (patch) | |
tree | 4b28dd3b310ebcfa9cefa1b41992eeefa5456764 /common/queryrunner.cpp | |
parent | c1475df297975b403d991f69ef9436cd576c1e46 (diff) | |
download | sink-096d14f20f4dc39d20d35d605ca755b66bd48cf9.tar.gz sink-096d14f20f4dc39d20d35d605ca755b66bd48cf9.zip |
Account filter for resources and contains comparator in query
Diffstat (limited to 'common/queryrunner.cpp')
-rw-r--r-- | common/queryrunner.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index bbaae7b..38fc779 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp | |||
@@ -382,9 +382,9 @@ QueryWorker<DomainType>::getFilter(const QSet<QByteArray> remainingFilters, cons | |||
382 | for (const auto &filterProperty : remainingFilters) { | 382 | for (const auto &filterProperty : remainingFilters) { |
383 | const auto property = domainObject->getProperty(filterProperty); | 383 | const auto property = domainObject->getProperty(filterProperty); |
384 | if (property.isValid()) { | 384 | if (property.isValid()) { |
385 | // TODO implement other comparison operators than equality | 385 | const auto comparator = query.propertyFilter.value(filterProperty); |
386 | if (property != query.propertyFilter.value(filterProperty)) { | 386 | if (!comparator.matches(property)) { |
387 | Trace() << "Filtering entity due to property mismatch on filter: " << filterProperty << property << ":" << query.propertyFilter.value(filterProperty); | 387 | Trace() << "Filtering entity due to property mismatch on filter: " << filterProperty << property << ":" << comparator.value; |
388 | return false; | 388 | return false; |
389 | } | 389 | } |
390 | } else { | 390 | } else { |
@@ -445,10 +445,10 @@ QPair<qint64, qint64> QueryWorker<DomainType>::executeInitialQuery( | |||
445 | if (!query.parentProperty.isEmpty()) { | 445 | if (!query.parentProperty.isEmpty()) { |
446 | if (parent) { | 446 | if (parent) { |
447 | Trace() << "Running initial query for parent:" << parent->identifier(); | 447 | Trace() << "Running initial query for parent:" << parent->identifier(); |
448 | modifiedQuery.propertyFilter.insert(query.parentProperty, parent->identifier()); | 448 | modifiedQuery.propertyFilter.insert(query.parentProperty, Query::Comparator(parent->identifier())); |
449 | } else { | 449 | } else { |
450 | Trace() << "Running initial query for toplevel"; | 450 | Trace() << "Running initial query for toplevel"; |
451 | modifiedQuery.propertyFilter.insert(query.parentProperty, QVariant()); | 451 | modifiedQuery.propertyFilter.insert(query.parentProperty, Query::Comparator(QVariant())); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | auto revisionAndReplayedEntities = load(modifiedQuery, [&](Sink::Storage::Transaction &transaction, QSet<QByteArray> &remainingFilters, QByteArray &remainingSorting) -> ResultSet { | 454 | auto revisionAndReplayedEntities = load(modifiedQuery, [&](Sink::Storage::Transaction &transaction, QSet<QByteArray> &remainingFilters, QByteArray &remainingSorting) -> ResultSet { |