Skip to content

Commit

Permalink
GEOS-6683 follow up, an extra count is still being performed
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Jan 22, 2015
1 parent c6a9baf commit 512ebe0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/wfs/src/main/java/org/geoserver/wfs/GetFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
package org.geoserver.wfs;

import static org.geoserver.ows.util.ResponseUtils.*;
import static org.geoserver.ows.util.ResponseUtils.buildURL;

import java.io.IOException;
import java.math.BigInteger;
Expand Down Expand Up @@ -498,9 +498,13 @@ public FeatureCollectionResponse run(GetFeatureRequest request)
boolean calculateSize = true;

// optimization: WFS 1.0 does not require count unless we have multiple query elements
// and we are asked to perform a global limit on the results returned
calculateSize = !(("1.0".equals(request.getVersion()) || "1.0.0".equals(request.getVersion())) &&
(queries.size() == 1 || maxFeatures == Integer.MAX_VALUE));
// and we are asked to perform a global limit on the results returned. Also,
// we don't want to count the size if there is just one element and number match
// skipped is true
isNumberMatchedSkipped = meta.getSkipNumberMatched();
calculateSize = !(("1.0".equals(request.getVersion()) || "1.0.0".equals(request
.getVersion())) && (queries.size() == 1 || maxFeatures == Integer.MAX_VALUE))
&& !(queries.size() == 1 && isNumberMatchedSkipped);

if (!calculateSize) {
//if offset was specified and we have more queries left in this request then we
Expand Down Expand Up @@ -542,7 +546,6 @@ public FeatureCollectionResponse run(GetFeatureRequest request)
// collect queries required to return numberMatched/totalSize
// check maxFeatures and offset, if they are unset we can use the size we
// calculated above
isNumberMatchedSkipped = meta.getSkipNumberMatched();
if (!isNumberMatchedSkipped) {
if (calculateSize && queryMaxFeatures == Integer.MAX_VALUE && offset == 0) {
totalCountExecutors.add(new CountExecutor(size));
Expand Down

0 comments on commit 512ebe0

Please sign in to comment.