aodn / aodn-portal

AODN Open Geospatial Portal
https://portal.aodn.org.au/
GNU General Public License v3.0
21 stars 13 forks source link

Problem with filters when using special character (e.g apostrophe in L'Astrolabe) #185

Closed smancini closed 11 years ago

smancini commented 11 years ago

I did a test of the WFS scanner on the release candidate portal.

I performed my test on the "SST - All tracks" layer (name: soop_sst_mv). I have enabled the filter "vessel_name" for that particular layer.

On the portal, it is possible to filter the layer for most of the vessels (e.g Stadacona ...) The filter is not working when you select the french vessel L'Astrolabe. The problem is that no tracks are displayed on the map when you select this vessel. the presence of the apostrophe in the vessel name is probably causing a problem to the CQL filter.

On the production portal, I manually configured the filter by entering the vessel name Astrolabe without the apostrophe and the filter was working fine.

jonescc commented 11 years ago

An exception is being returned for the GetMap request including L'Astrolabe as follows:

Could not parse CQL filter list. Encountered "Astrolabe" at line 1, column 22. Was expecting one of: "and" ... "or" ... ";" ... Parsing : vessel_name LIKE '%L'Astrolabe%'

Looks like the apostrophe needs to be escaped

tojofo commented 11 years ago

Does CQL allow single quotes to be escaped with other single quotes?

jonescc commented 11 years ago

No, but it looks like they can be escaped by enclosing them in "" and \" used within these to escape " itself Just testing before making changes...

jonescc commented 11 years ago

Actually single quoting IS the correct method. From the GeoServer manual:

String String literal delimited by single quotes. To include a single quote in the string use two single-quotes: ''

retested and this works, so I'll change the filter code to escape accordingly.