[Geoserver-users] CQL filter function, parse error

Hello All,

I am trying to use CQL filter function available in geoserver but it gives
me parse error.

Here is the filter function reference:

http://docs.geoserver.org/2.0.x/en/user/filter/function_reference.html

and I took example from this tutorial:

http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html

I use strToUpperCase, for states layer in CQL:

strToUpperCase(STATE_NAME) like '%M%'

and error message comes:

Could not parse cql filter list.

encountered 'like' at line 1.

when I dont use strToUpperCase it works but why not filter function
strToUpperCase or strToLowerCase working?

Any help is appreciated.

Thanks in advance.

http://old.nabble.com/file/p30994722/CQL%2Bparse%2Berror.jpg
--
View this message in context: http://old.nabble.com/CQL-filter-function%2C-parse-error-tp30994722p30994722.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

IIRC we have switched from the ‘CQL2’ CQL module to the ‘ECQL’ one in GeoServer trunk. It seems that the older module (which you are still using) does not allow functions (only property names) as the left-hand-side of a ‘LIKE’ comparison.

I think updating to GeoServer 2.1 (not yet released, but in RC status) would allow you to use this filter. Alternatively, you can rewrite your filter using nested functions instead:

isLike(strToUpperCase(STATE_NAME) like ‘%M%’)

hope this helps.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Feb 23, 2011 at 8:05 AM, SSA <sandeep_deep@anonymised.com…> wrote:

Hello All,

I am trying to use CQL filter function available in geoserver but it gives
me parse error.

Here is the filter function reference:

http://docs.geoserver.org/2.0.x/en/user/filter/function_reference.html

and I took example from this tutorial:

http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html

I use strToUpperCase, for states layer in CQL:

strToUpperCase(STATE_NAME) like ‘%M%’

and error message comes:

Could not parse cql filter list.

encountered ‘like’ at line 1.

when I dont use strToUpperCase it works but why not filter function
strToUpperCase or strToLowerCase working?

Any help is appreciated.

Thanks in advance.

http://old.nabble.com/file/p30994722/CQL%2Bparse%2Berror.jpg

View this message in context: http://old.nabble.com/CQL-filter-function%2C-parse-error-tp30994722p30994722.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Thank you David for your reply and time but this didn't work either. I have
stable version in production so I am afraid if I can do anything to improve
search. I'll install 2.1 RC to see if this works there.

Its strange that documentation for 2.0 still mentions to use cql filter
function while they don't work.

David Winslow-5 wrote:

IIRC we have switched from the 'CQL2' CQL module to the 'ECQL' one in
GeoServer trunk. It seems that the older module (which you are still
using)
does not allow functions (only property names) as the left-hand-side of a
'LIKE' comparison.

I think updating to GeoServer 2.1 (not yet released, but in RC status)
would
allow you to use this filter. Alternatively, you can rewrite your filter
using nested functions instead:

isLike(strToUpperCase(STATE_NAME) like '%M%')

hope this helps.

--
David Winslow
OpenGeo - http://opengeo.org/

On Wed, Feb 23, 2011 at 8:05 AM, SSA <sandeep_deep@anonymised.com> wrote:

--
View this message in context: http://old.nabble.com/CQL-filter-function%2C-parse-error-tp30994722p30995962.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Oops, the CQL I posted was not what I meant. You can try this:

isLike(strToUpperCase(STATE_ABBR), ‘%M%’) == true

You could also look into using XML-encoded filters (like you use in SLD) instead of CQL.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Feb 23, 2011 at 10:39 AM, SSA <sandeep_deep@anonymised.com> wrote:

Thank you David for your reply and time but this didn’t work either. I have
stable version in production so I am afraid if I can do anything to improve
search. I’ll install 2.1 RC to see if this works there.

Its strange that documentation for 2.0 still mentions to use cql filter
function while they don’t work.

David Winslow-5 wrote:

IIRC we have switched from the ‘CQL2’ CQL module to the ‘ECQL’ one in
GeoServer trunk. It seems that the older module (which you are still
using)
does not allow functions (only property names) as the left-hand-side of a
‘LIKE’ comparison.

I think updating to GeoServer 2.1 (not yet released, but in RC status)
would
allow you to use this filter. Alternatively, you can rewrite your filter
using nested functions instead:

isLike(strToUpperCase(STATE_NAME) like ‘%M%’)

hope this helps.


David Winslow
OpenGeo - http://opengeo.org/

On Wed, Feb 23, 2011 at 8:05 AM, SSA <sandeep_deep@anonymised.com> wrote:


View this message in context: http://old.nabble.com/CQL-filter-function%2C-parse-error-tp30994722p30995962.html

Sent from the GeoServer - User mailing list archive at Nabble.com.


Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On Wed, Feb 23, 2011 at 7:39 AM, SSA <sandeep_deep@anonymised.com> wrote:

Thank you David for your reply and time but this didn’t work either. I have
stable version in production so I am afraid if I can do anything to improve
search. I’ll install 2.1 RC to see if this works there.

Its strange that documentation for 2.0 still mentions to use cql filter
function while they don’t work.

The functions do work, as David alreayd explained what you’re seeing is a limitation of the official
OGC CQL language (which is documented in its own OGC standard, I think it’s
the catalog one).
A CQL comparison can only have this structure:

whilst yours is

GeoServer 2.1 uses ECQL (extended CQL), a home grown set of extensions
on top of the standard CQL that makes the language more similar to SQL and
allows, among others, for the
form to be parsed successfully

Hope this helps

Cheers
Andrea

Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf