Skip to content

Commit

Permalink
Fix FilterExpression feature requests will ignore expression if
Browse files Browse the repository at this point in the history
using virtual fields or other complex filters

refs #13695

(cherry-picked from dddd043)
  • Loading branch information
nyalldawson committed Nov 18, 2015
1 parent 5d359a6 commit 3c11a5d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/qgsvectorlayerfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ bool QgsVectorLayerFeatureIterator::fetchFeature( QgsFeature& f )
if ( mHasVirtualAttributes )
addVirtualAttributes( f );

if ( mRequest.filterType() == QgsFeatureRequest::FilterExpression && mProviderRequest.filterType() != QgsFeatureRequest::FilterExpression )
{
//filtering by expression, and couldn't do it on the provider side
mRequest.expressionContext()->setFeature( f );
if ( !mRequest.filterExpression()->evaluate( mRequest.expressionContext() ).toBool() )
{
//feature did not match filter
continue;
}
}

// update geometry
// TODO[MK]: FilterRect check after updating the geometry
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
Expand Down

0 comments on commit 3c11a5d

Please sign in to comment.