GetMap uses only one clause of a multivalued CQL_FILTER on a layer group


I created a layer group containing 1) a geography from a directory of shapefiles and 2) features pulled from Oracle via a sql view. I applied blending styles to the layers so the features would display differently depending on whether they fell over land or water in the geography layer. I would like to be able to filter (and cache) the tiles based on certain Oracle queries, but the geography layer does not need filtering. To this end, I tried using a CQL_FILTER in the form: "1=1;attr='value'" . While this appeared to be the correct format for applying a different filter to each layer in the group, the feature layer would now show all features rather than filter for only those where attr='value'. (Previously I had successfully used the CQL_FILTER "attr='value'" on the same feature layer by itself, not in a layer group.)

Server debug output showed that CQL_FILTER appeared to be parsed correctly, but a "Filters" property that gets built by GetMapKvpRequestReader instead shows only the first filter (the "1=1") repeated for each layer:

15 Dec 11:41:39 INFO [geoserver.wms] -
Request: getMap
Tiled = true
Interpolations = []
Width = 768
Height = 737
Filters = [[ 1 = 1 ], [ 1 = 1 ]]
Styles = [StyleImpl[ name=style1], StyleImpl[ name=style2]]
MaxFeatures = null
Format = image/png
Time = []
Filter = [[ 1 = 1 ], [ 1 = 1 ]]
Buffer = 0
Crs = PROJCS["WGS 84 / Pseudo-Mercator",
CQLFilter = [[ 1 = 1 ], [ attr = value ]]
RawKvp = {BBOX=-30022616.05686392,-29592604.62896613,30022616.05686392,28028926.7093378, SERVICE=WMS, HEIGHT=737, REQUEST=GetMap, STYLES=, WIDTH=768, STYLE=style1,style2, CQL_FILTER=1=1;attr='value', TRANSPARENT=true, VERSION=1.1.1, FORMAT=image/png, LAYERS=layergroup1, SRS=EPSG:3857}

The filters in GetMap, not the CQLFilter, seem to govern the tiles that are painted, so the 1=1 is applied to both layers in the group and the attr='value' filter is lost.

If I modify GetMapKvpRequestReader to keep each clause of the CQL_FILTER with the ordered layers in the group as it builds the Filters property, then Filters comes out identical to CQLFilter, and filtering by feature works as expected in my layer group. I have attached this change and an additional unit test testMultipleCQLFilters, based on the 2.8.0 branch.






Lisa Larson



Fix versions


Affects versions