Avoid evaluating unnecessary filters

refs #10360
This commit is contained in:
Gunnar Beutner 2015-10-14 16:52:01 +02:00
parent f841daf680
commit 21a2986635
1 changed files with 6 additions and 7 deletions

View File

@ -231,12 +231,6 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
if (!query->Contains("type")) if (!query->Contains("type"))
BOOST_THROW_EXCEPTION(std::invalid_argument("Type must be specified when using a filter.")); BOOST_THROW_EXCEPTION(std::invalid_argument("Type must be specified when using a filter."));
String filter;
if (!query->Contains("filter"))
filter = "true";
else
filter = HttpUtility::GetLastParameter(query, "filter");
String type = HttpUtility::GetLastParameter(query, "type"); String type = HttpUtility::GetLastParameter(query, "type");
if (!provider->IsValidType(type)) if (!provider->IsValidType(type))
@ -249,7 +243,12 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
frame.Sandboxed = true; frame.Sandboxed = true;
Dictionary::Ptr uvars = new Dictionary(); Dictionary::Ptr uvars = new Dictionary();
Expression *ufilter = ConfigCompiler::CompileText("<API query>", filter); Expression *ufilter = NULL;
if (query->Contains("filter")) {
String filter = HttpUtility::GetLastParameter(query, "filter");
ufilter = ConfigCompiler::CompileText("<API query>", filter);
}
Dictionary::Ptr filter_vars = query->Get("filter_vars"); Dictionary::Ptr filter_vars = query->Get("filter_vars");
if (filter_vars) { if (filter_vars) {