Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 1c076ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/locator/qgsinbuiltlocatorfilters.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -625,6 +625,8 @@ void QgsAllLayersFeaturesLocatorFilter::fetchResults( const QString &string, con
if ( foundInCurrentLayer >= mMaxResultsPerLayer )
break;
}
if ( foundInCurrentLayer >= mMaxResultsPerLayer )
continue;
if ( foundInTotal >= mMaxTotalResults )
break;

Expand Down

0 comments on commit 1c076ee

Please sign in to comment.