Hi Ben,

Thanks a lot for the detailed reply and the hints. I can confirm that in 
my case filter 2.0 was used with version 2.3.5. It is exactly like it is 
now and I have just removed matchCase to make it work in version 2.8.1 
according to your explanation. Perhaps someone has modified the schema 
in the meantime to make it conform with Filter 2.0 spec?

Regarding the umlauts, I use URLEncoder.encode() to encode the filter 
part and it seems to properly percent-encode the letters.

Please try the following, which is the working example from you in your 
previous email in which I just replace the literal "*" with "ü*" and "Ü*":

This (with "ü*") works although returning 0 records:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=topp:states&filter=%3Cfes:Filter%20xmlns:fes=%22http://www.opengis.net/fes/2.0%22%3E%3Cfes:PropertyIsLike%20wildCard=%22*%22%20singleChar=%22%23%22%20escapeChar=%22!%22%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E%C3%BC*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E

This (with "Ü*") breaks the XML parsing, and we receive the exception:

http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=topp:states&filter=%3Cfes:Filter%20xmlns:fes=%22http://www.opengis.net/fes/2.0%22%3E%3Cfes:PropertyIsLike%20wildCard=%22*%22%20singleChar=%22%23%22%20escapeChar=%22!%22%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E%C3%9C*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E

I've tried the 2 Urls above with Geoserver 2.8.1.

Best regards,
Nhan Vo


On 1/21/2016 1:23 PM, Ben Caradoc-Davies wrote:
> Nhan Vo,
>
> when you used PropertyIsLike/@matchCase="false" previously with 
> GeoServer 2.3.5, did you use Filter 2.0 or Filter 1.1?
>
> I looked a little deeper and matchCase="false" *should* be supported 
> on PropertyIsLike in GeoServer WFS 1.1 because Niels kindly updated 
> GeoTools to use the FES 1.1.3 schemas back in 2013 to add matchCase 
> support:
> http://osgeo-org.1560.x6.nabble.com/ogc-filter-1-1-doesn-t-support-matchCase-in-PropertyIsLike-td5079577.html
>  
>
> https://github.com/geotools/geotools/commit/4855cba310362f488d5686eda1fff17d7d02c714
>  
>
> http://schemas.opengis.net/filter/1.1.0/filter.xsd
>
> I changed the GET request to use WFS 1.1 and can confirm that 
> matchCase="false" works. The request matches "illino*" to "Illinois":
> http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=topp:states&filter=%3Cogc:Filter%20xmlns:ogc=%22http://www.opengis.net/ogc%22%3E%3Cogc:PropertyIsLike%20matchCase=%22false%22%20wildCard=%22*%22%20singleChar=%22%23%22%20escapeChar=%22!%22%3E%3Cogc:PropertyName%3Etopp:STATE_NAME%3C/ogc:PropertyName%3E%3Cogc:Literal%3Eillino*%3C/ogc:Literal%3E%3C/ogc:PropertyIsLike%3E%3C/ogc:Filter%3E
>  
>
>
> *But* if I look at even the latest schemas and standard for FES 2.0.2, 
> there is no matchCase on PropertyIsLike:
> http://schemas.opengis.net/filter/2.0/filter.xsd
> http://docs.opengeospatial.org/is/09-026r2/09-026r2.html
>
> I think this is a bug in the FES 2.0.2 schemas. I think GeoServer will 
> need updated schemas to fix this for WFS 2.0 (and we can see that the 
> XML parsing is horribly broken without this fix). We may need a change 
> request (or an email to the standard maintainer):
> http://www.opengeospatial.org/standards/cr
>
> If I add a single line to the definition of PropertyIsLikeType in the 
> copy of the FES 2.0 schemas in GeoTools gt-xsd-fes:
> modules/extension/xsd/xsd-fes/src/main/resources/org/geotools/filter/v2_0/filter.xsd
>  
>
> <xsd:attribute name="matchCase" type="xsd:boolean" use="optional" 
> default="true"/>
>
> then suddenly matchCase="false" on PropertyIsLike starts working for 
> WFS 2.0 in GeoServer, just as as for WFS 1.1:
> http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=topp:states&filter=%3Cfes:Filter%20xmlns:fes=%22http://www.opengis.net/fes/2.0%22%3E%3Cfes:PropertyIsLike%20matchCase=%22false%22%20wildCard=%22*%22%20singleChar=%22%23%22%20escapeChar=%22!%22%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3Eillino*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E
>  
>
>
> GeoServer also supports a CQL_FILTER vendor parameter that has case 
> insensitive "ilike" support:
> http://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#cql-filters 
>
> See the "strToLowerCase(STATE_NAME) like '%m%'" example in the tutorial:
> http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html
> or the "ilike" predicate:
> http://docs.geoserver.org/latest/en/user/filter/ecql_reference.html
>
> As for letters outside ASCII ("Ü", "Ö", "Ä", "ü", "ö", "ä"), if you 
> are using them in URLs such as encoded filters, are you 
> percent-encoding these as required by RFC 3986?:
> https://en.wikipedia.org/wiki/Percent-encoding
> https://tools.ietf.org/html/rfc3986
>
> $ python
> Python 2.7.11 (default, Jan 11 2016, 21:04:40)
> [GCC 5.3.1 20160101] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import urllib
> >>> for c in ("Ü", "Ö", "Ä", "ü", "ö", "ä"): print c, urllib.quote(c)
> ...
> Ü %C3%9C
> Ö %C3%96
> Ä %C3%84
> ü %C3%BC
> ö %C3%B6
> ä %C3%A4
>
> Kind regards,
> Ben.
>
> On 21/01/16 22:15, Nhan Vo wrote:
>> Hi Ben,
>>
>> Thanks for the helpful reply. The exception message was indeed
>> misleading. A couple of points left, I hope you'd look into them:
>>
>> 1. How come matchCase was supported in version 2.3.5 but not anymore in
>> 2.8.1? Personally I find it really useful. Is there a way to make a
>> search with PropertyIsLike case-insensitive?
>>
>> 2. I had this problem already with version 2.3.5 and it seems to persist
>> in version 2.8.1: When the search text contains a German letter with
>> umlaut in upper-case (Ü, Ö, Ä), I got the exception "Attempted to
>> construct illegal filter - I dont understand the tag:
>> fes:ValueReference.  HINT: tags are case-sensitive!".  ü, ö, ä are
>> however fine. As an added advantage with matchCase='false' I could get
>> around this problem, but not anymore in 2.8.1. If possible could you
>> shed some light on this?
>>
>> Any hints or pointers are much appreciated!
>>
>> Best regards,
>> Nhan Vo
>>
>>
>>
>> On 1/20/2016 11:44 PM, Ben Caradoc-Davies wrote:
>>> Nhan Vo,
>>>
>>> neither singleChar="%" nor singleChar="#" work for me until I
>>> percent-encode them as singleChar="%25" or singleChar="%23"
>>> respectively. "%" is used for URL percent-encoding and "#" is the URL
>>> fragment separator and neither can be used unencoded in a URL. I am
>>> surprised that either worked for you before. Perhaps older Java or
>>> GeoServer was more permissive, or your client is encoding one but not
>>> the other? I think Java 8 may have added better unicode support in
>>> percent decoding; this may be the change.
>>>
>>> Furthermore, matchCase is not permitted on PropertyIsLike. Including
>>> this attribute caused the rather unhelpful error message: "Attempted
>>> to construct illegal filter - I dont understand the tag:
>>> fes:ValueReference.  HINT: tags are case-sensitive!"
>>>
>>> Both of these URLs work for me against the current GeoServer master
>>> release configuration with Java 8:
>>>
>>> http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=topp:states&filter=%3Cfes:Filter%20xmlns:fes=%22http://www.opengis.net/fes/2.0%22%3E%3Cfes:PropertyIsLike%20wildCard=%22*%22%20singleChar=%22%23%22%20escapeChar=%22!%22%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E
>>>  
>>>
>>>
>>>
>>> http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=topp:states&filter=%3Cfes:Filter%20xmlns:fes=%22http://www.opengis.net/fes/2.0%22%3E%3Cfes:PropertyIsLike%20wildCard=%22*%22%20singleChar=%22%25%22%20escapeChar=%22!%22%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E
>>>  
>>>
>>>
>>>
>>> Kind regards,
>>> Ben.
>>>
>>> On 21/01/16 02:04, Nhan Vo wrote:
>>>> Hi,
>>>>
>>>> Thanks for the response. This URL works:
>>>> http://192.168.0.102:8081/geoserver/wfs?VERSION=2.0.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=topp:states&FILTER=%3Cfes:Filter%20xmlns:fes='http://www.opengis.net/fes/2.0'%20xmlns:gml='http://www.opengis.net/gml/3.2'%3E%3Cfes:PropertyIsLike%20matchCase='false'%20wildCard='*'%20singleChar='%'%20escapeChar='!'%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E
>>>>  
>>>>
>>>>
>>>>
>>>>
>>>> This does not work:
>>>> http://192.168.0.102:8081/geoserver/wfs?VERSION=2.0.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=topp:states&FILTER=%3Cfes:Filter%20xmlns:fes='http://www.opengis.net/fes/2.0'%20xmlns:gml='http://www.opengis.net/gml/3.2'%3E%3Cfes:PropertyIsLike%20matchCase='false'%20wildCard='*'%20singleChar='#'%20escapeChar='!'%3E%3Cfes:ValueReference%3Etopp:STATE_NAME%3C/fes:ValueReference%3E%3Cfes:Literal%3E*%3C/fes:Literal%3E%3C/fes:PropertyIsLike%3E%3C/fes:Filter%3E
>>>>  
>>>>
>>>>
>>>>
>>>> The only difference is /*singleChar='%'*/ and /*singleChar='#'*/.
>>>>
>>>> Best regards,
>>>> Nhan Vo
>>>>
>>>> On 1/20/2016 1:53 PM, Rahkonen Jukka (MML) wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Can you reproduce the issue with the demo layer ”states”? If you
>>>>> can, please
>>>>> send the whole GET url for making testing convenient for the others.
>>>>>
>>>>> Regards,
>>>>>
>>>>> -Jukka Rahkonen-
>>>>>
>>>>> Nhan Vo wrote:
>>>>>
>>>>> Hi list,
>>>>>
>>>>> I'm upgrading Geoserver from 2.3.5 to 2.8.1 and my client code
>>>>> cannot work
>>>>> anymore. Basically it sends a WFS Url request with a filter to
>>>>> Geoserver. The
>>>>> filter looks as follows:
>>>>>
>>>>> <fes:Filter xmlns:fes='http://www.opengis.net/fes/2.0'
>>>>> xmlns:gml='http://www.opengis.net/gml/3.2'>
>>>>>     <fes:PropertyIsLike matchCase='false' wildCard='*' singleChar='#'
>>>>> escapeChar='!'>
>>>>> <fes:ValueReference>...</fes:ValueReference>
>>>>>         <fes:Literal>...</fes:Literal>
>>>>>     </fes:PropertyIsLike>
>>>>> </fes:Filter>
>>>>>
>>>>> With version 2.8.1 I receive the exception message:*XML document
>>>>> structures
>>>>> must start and end within the same entity*
>>>>>
>>>>> I have been able to get around this by replacing */singleChar='#'/*
>>>>> with
>>>>> */singleChar='%'/*, but still cannot understand why the '#' causes 
>>>>> the
>>>>> problem. Also, '.' and '_' do not work either and I receive the same
>>>>> exception
>>>>> message. Only '%' works.
>>>>>
>>>>> Btw, Geoserver 2.3.5 was running with Java 6; when I updated to
>>>>> 2.8.1 I also
>>>>> updated to Java 8.
>>>>>
>>>>> If someone could shed some light on this I'd appreciate it.
>>>>>
>>>>> Best regards,
>>>>> Nhan Vo
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>  
>>>>
>>>>
>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>> Monitor end-to-end web transactions and take corrective actions now
>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Geoserver-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>>
>>>
>>
>>
>


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to