summaryrefslogtreecommitdiffstats
path: root/common/queryrunner.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-12-28 11:26:45 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-12-28 11:26:45 +0100
commitefbb9a602c380fafc8f969c3e323ce9e85935809 (patch)
tree17c27d17f03a5cb31fb1e1fd20882fa0c2cd918d /common/queryrunner.cpp
parentfb41cc4b30792238eed235aa5c6a8a3ba47b87a6 (diff)
downloadsink-efbb9a602c380fafc8f969c3e323ce9e85935809.tar.gz
sink-efbb9a602c380fafc8f969c3e323ce9e85935809.zip
Fixed incremental updates in folder queries
Incremental additions of children in the tree were filtered due to the parent filter. This broke when we started to maintain state, thus causing the filter in datastorequery containing the parent filter to be carried over. Given that the incremental querying of children currently doesn't really add much value (we don't have trees that are large/deep enough), perhaps we're better off using a different approach.
Diffstat (limited to 'common/queryrunner.cpp')
-rw-r--r--common/queryrunner.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index f196965..f3a9af8 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -245,23 +245,12 @@ ReplayResult QueryWorker<DomainType>::executeInitialQuery(
245 QTime time; 245 QTime time;
246 time.start(); 246 time.start();
247 247
248 auto modifiedQuery = query;
249 if (!query.parentProperty().isEmpty()) {
250 if (parent) {
251 SinkTraceCtx(mLogCtx) << "Running initial query for parent:" << parent->identifier();
252 modifiedQuery.filter(query.parentProperty(), Query::Comparator(QVariant::fromValue(Sink::ApplicationDomain::Reference{parent->identifier()})));
253 } else {
254 SinkTraceCtx(mLogCtx) << "Running initial query for toplevel";
255 modifiedQuery.filter(query.parentProperty(), Query::Comparator(QVariant{}));
256 }
257 }
258
259 auto entityStore = EntityStore{mResourceContext, mLogCtx}; 248 auto entityStore = EntityStore{mResourceContext, mLogCtx};
260 auto preparedQuery = [&] { 249 auto preparedQuery = [&] {
261 if (state) { 250 if (state) {
262 return DataStoreQuery{*state, ApplicationDomain::getTypeName<DomainType>(), entityStore, false}; 251 return DataStoreQuery{*state, ApplicationDomain::getTypeName<DomainType>(), entityStore, false};
263 } else { 252 } else {
264 return DataStoreQuery{modifiedQuery, ApplicationDomain::getTypeName<DomainType>(), entityStore}; 253 return DataStoreQuery{query, ApplicationDomain::getTypeName<DomainType>(), entityStore};
265 } 254 }
266 }(); 255 }();
267 auto resultSet = preparedQuery.execute(); 256 auto resultSet = preparedQuery.execute();