From a16ae6c64b75706f9663fb27510a73d1a6a29de8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 19 Mar 2017 12:28:17 +0100 Subject: Handle filtered thread-leader --- common/datastorequery.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/datastorequery.cpp b/common/datastorequery.cpp index 34d2bae..0db59e1 100644 --- a/common/datastorequery.cpp +++ b/common/datastorequery.cpp @@ -152,7 +152,7 @@ public: } }; -class Reduce : public FilterBase { +class Reduce : public Filter { public: typedef QSharedPointer Ptr; @@ -198,7 +198,7 @@ public: QList mAggregators; Reduce(const QByteArray &reductionProperty, const QByteArray &selectionProperty, QueryBase::Reduce::Selector::Comparator comparator, FilterBase::Ptr source, DataStoreQuery *store) - : FilterBase(source, store), + : Filter(source, store), mReductionProperty(reductionProperty), mSelectionProperty(selectionProperty), mSelectionComparator(comparator) @@ -236,6 +236,11 @@ public: for (const auto &r : results) { readEntity(r, [&, this](const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Operation operation) { + //We need to apply all property filters that we have until the reduction, because the index lookup was unfiltered. + if (!matchesFilter(entity)) { + return; + } + Q_ASSERT(operation != Sink::Operation_Removal); for (auto &aggregator : mAggregators) { if (!aggregator.property.isEmpty()) { @@ -553,6 +558,7 @@ void DataStoreQuery::setupQuery(const Sink::QueryBase &query_) for (const auto &aggregator : filter->aggregators) { reduction->mAggregators << Reduce::Aggregator(aggregator.operation, aggregator.propertyToCollect, aggregator.resultProperty); } + reduction->propertyFilter = query.getBaseFilters(); baseSet = reduction; } else if (auto filter = stage.dynamicCast()) { baseSet = Bloom::Ptr::create(filter->property, baseSet, this); -- cgit v1.2.3