Observed an issue that, WFS request with OGC filter in XML payload not returning matching results if there are multiple whitespaces in the literal value. We could see in the GeoServer log that, the multiple spaces has been replaced with single space on the filter and it couldn’t find any matching data on the database.
For example: There is a text value “WFS filter testing
” in the database table. When we applying filter with this, in the GeoServer the text is replaced as “WFS filter testing” and its not returning zero results.
Below is the sample XML payload we are using:
> <wfs:GetFeature xmlns:wfs='XXX' xmlns:ogc='XXX' xmlns:gml='XXX' xmlns:cgf='XXX' version='1.0.0' outputFormat='JSON' service='wfs'>
> <wfs:Query typeName='SurveyPolygon' srsName='urn:ogc:def:crs:EPSG::3857' encoding="UTF-8">
> <ogc:Filter>
> <ogc:PropertyIsEqualTo>
> <ogc:PropertyName>SurveyName</ogc:PropertyName>
> <ogc:Literal>WFS filter testing</ogc:Literal>
> </ogc:PropertyIsEqualTo>
> </ogc:Filter>
> </wfs:Query>
> </wfs:GetFeature>
We could see below from the GeoServer log that, the multiple spaces has been replaced with single space:
10 Sep 12:49:11 INFO [geoserver.wfs] -
Request: getFeature
service = wfs
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
query[0]:
filter = [ SurveyName = WFS filter testing ]
srsName = urn:ogc:def:crs:EPSG::3857
typeName[0] = {Versal}SurveyPolygon
outputFormat = JSON
resultType = results
10 Sep 12:49:11 INFO [wfs.json] - about to encode JSON
Appreciate if someone could help on resolving the issue.