Skip to content
Permalink
Browse files

Merge pull request #40151 from m-kuhn/locator_filter_respect_search_l…

…imit

[all features locator] respect search limits
  • Loading branch information
m-kuhn committed Nov 18, 2020
2 parents a4b91a0 + ceb4238 commit 1c076ee6ea517870b62a92faed899030b5f2ce5a
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/app/locator/qgsinbuiltlocatorfilters.cpp
@@ -563,12 +563,12 @@ QStringList QgsAllLayersFeaturesLocatorFilter::prepare( const QString &string, c
enhancedSearch.replace( ' ', '%' );
req.setFilterExpression( QStringLiteral( "%1 ILIKE '%%2%'" )
.arg( layer->displayExpression(), enhancedSearch ) );
req.setLimit( 6 );
req.setLimit( mMaxResultsPerLayer );

QgsFeatureRequest exactMatchRequest = req;
exactMatchRequest.setFilterExpression( QStringLiteral( "%1 ILIKE '%2'" )
.arg( layer->displayExpression(), enhancedSearch ) );
exactMatchRequest.setLimit( 10 );
exactMatchRequest.setLimit( mMaxResultsPerLayer );

std::shared_ptr<PreparedLayer> preparedLayer( new PreparedLayer() );
preparedLayer->expression = expression;
@@ -625,6 +625,8 @@ void QgsAllLayersFeaturesLocatorFilter::fetchResults( const QString &string, con
if ( foundInCurrentLayer >= mMaxResultsPerLayer )
break;
}
if ( foundInCurrentLayer >= mMaxResultsPerLayer )
continue;
if ( foundInTotal >= mMaxTotalResults )
break;

0 comments on commit 1c076ee

Please sign in to comment.
You can’t perform that action at this time.