wfs-ng maxFeatures applied before Filters on WFS requests with MapServer

Description

From Matthew Wagner USGS Contractor via email:

Currently, I am using Geoserver 2.15.1, JVM 1.8.0_171 on Ubuntu 16.04.6 LTS.

I have run into an issue when making WFS calls on Geoserver to a Web Feature Server (NG) vector data source. In particular, it seems that maxFeatures is applied before Filters when making a request. This means that Geoserver pulls maxFeatures number of records then filters them. However, when I apply the same query directly to the endpoint, it seems to work the other way where it returns maxFeatures number of records that match the filter.

The Web Feature Server (NG) I am using is a public USGS data store:
https://cartowfs.nationalmap.gov/arcgis/services/structures/MapServer/WFSServer?request=GetCapabilities&service=WFS

I have tested this with the following WFS request that was a OGC standard filter. I have also applied an equivalent filter to my geoserver to note the differences.

Additionally, I have found a past thread in the mailing list that mentions this problem but doesn't mention any sort of resolution.

https://sourceforge.net/p/geoserver/mailman/message/31683282/

Environment

None

Status

Assignee

Ian Turton

Reporter

Jody Garnett

Triage

None

Components

Fix versions

Affects versions

21.1

Priority

Medium
Configure