[Geoserver-users] CQL filter with multiple parameters

Dear all,

I have been trying for a couple days now to solve a very frustrating issue and I am hoping that you can provide me with some help.

I have set up Geoserver over an Accumulo datastore, when creating the layer I can see all the parameters and when I download all the dataset as one JSON file, I have no issues at all.

My issues start when I try to add the &cql_filter.

I want to query two of the parameters at once, so I do (working_uri_that_gives_all_data_as_json)&cql_filter=(Data_col<‘03/21//2018’ and id=2)

When I try this URI from my web-browser only the first restriction is taken into account, and when I try to sent it from JAVA as an HTTP request I get a URI malformed error.

I have tried adding single quotes around all the elements, adding or eliminating spaces between words, and anything else that could cross my mind but nothing seems to be working.

I have full control over the format of the URI so I can replace anything with the corresponding special character if that would help.

I am not sure if I am making an obvious mistake or not, but I would be greatful for any help.

Best regards,
Maria.

Perhaps you can see something in the logs? Its obviously a pretty difficult case to replicate here, but have you tried simplifying the query (e.g. just the id part).

Brad

From: Maria Krommyda via Geoserver-users geoserver-users@lists.sourceforge.net
Sent: Sunday, 8 July 2018 5:11 PM
To: Geoserver-users@anonymised.com.sourceforge.net
Subject: [Geoserver-users] CQL filter with multiple parameters

Dear all,

I have been trying for a couple days now to solve a very frustrating issue and I am hoping that you can provide me with some help.

I have set up Geoserver over an Accumulo datastore, when creating the layer I can see all the parameters and when I download all the dataset as one JSON file, I have no issues at all.

My issues start when I try to add the &cql_filter.

I want to query two of the parameters at once, so I do (working_uri_that_gives_all_data_as_json)&cql_filter=(Data_col<‘03/21//2018’ and id=2)

When I try this URI from my web-browser only the first restriction is taken into account, and when I try to sent it from JAVA as an HTTP request I get a URI malformed error.

I have tried adding single quotes around all the elements, adding or eliminating spaces between words, and anything else that could cross my mind but nothing seems to be working.

I have full control over the format of the URI so I can replace anything with the corresponding special character if that would help.

I am not sure if I am making an obvious mistake or not, but I would be greatful for any help.

Best regards,

Maria.

If id is the fid (and possibly even if it isn’t) then it is a special attribute and I suspect it is handled differently in the filters as is hinted at http://docs.geotools.org/stable/userguide/library/cql/ecql.html.

Try something like:

Data_col<‘03/21/2018’ and in (2)

and see if that works.

For speed I’d reverse the order of the query as checking the ID is likely to be much quicker than looking at all the dates.

Ian

···

Ian Turton

Dear Brad,

Thank you very much for your help. The simplified query always worked just fine.
I checked the logs and I realized that I could get there a more detailed error than the one I was getting from JAVA exeption

After googling it, the proplem was that I was adding spaces to the URI rather than the special character %20.

Thank you for directin me to the logs, I have not understood that the message there could be different to the one I was getting from running the code.

Best regards,
Maria.

Στις 11:34 π.μ. Κυριακή, 8 Ιουλίου 2018, ο/η “bradh@anonymised.combradh@anonymised.com έγραψε:

Perhaps you can see something in the logs? Its obviously a pretty difficult case to replicate here, but have you tried simplifying the query (e.g. just the id part).

Brad

From: Maria Krommyda via Geoserver-users geoserver-users@lists.sourceforge.net
Sent: Sunday, 8 July 2018 5:11 PM
To: Geoserver-users@anonymised.coms.sourceforge.net
Subject: [Geoserver-users] CQL filter with multiple parameters

Dear all,

I have been trying for a couple days now to solve a very frustrating issue and I am hoping that you can provide me with some help.

I have set up Geoserver over an Accumulo datastore, when creating the layer I can see all the parameters and when I download all the dataset as one JSON file, I have no issues at all.

My issues start when I try to add the &cql_filter.

I want to query two of the parameters at once, so I do (working_uri_that_gives_all_data_as_json)&cql_filter=(Data_col<‘03/21//2018’ and id=2)

When I try this URI from my web-browser only the first restriction is taken into account, and when I try to sent it from JAVA as an HTTP request I get a URI malformed error.

I have tried adding single quotes around all the elements, adding or eliminating spaces between words, and anything else that could cross my mind but nothing seems to be working.

I have full control over the format of the URI so I can replace anything with the corresponding special character if that would help.

I am not sure if I am making an obvious mistake or not, but I would be greatful for any help.

Best regards,

Maria.

Dear Ian,

Thank you very much for your suggestions, it is more like a test query to see how the cql_filter works rather than a real one, and id was the placeholder of a random integer for testing purposes, so it is not unique or handled differently.

As I mentioned it was only an overlook from my side using space in the URI and not %20.

Thank you very much for your time.

Best regards,
Maria.

Στις 12:21 μ.μ. Κυριακή, 8 Ιουλίου 2018, ο/η Ian Turton ijturton@anonymised.com έγραψε:

If id is the fid (and possibly even if it isn’t) then it is a special attribute and I suspect it is handled differently in the filters as is hinted at http://docs.geotools.org/stable/userguide/library/cql/ecql.html.

Try something like:

Data_col<‘03/21/2018’ and in (2)

and see if that works.

For speed I’d reverse the order of the query as checking the ID is likely to be much quicker than looking at all the dates.

Ian

On Sun, 8 Jul 2018 at 08:44, Maria Krommyda via Geoserver-users <geoserver-users@anonymised.comet> wrote:

Dear all,

I have been trying for a couple days now to solve a very frustrating issue and I am hoping that you can provide me with some help.

I have set up Geoserver over an Accumulo datastore, when creating the layer I can see all the parameters and when I download all the dataset as one JSON file, I have no issues at all.

My issues start when I try to add the &cql_filter.

I want to query two of the parameters at once, so I do (working_uri_that_gives_all_data_as_json)&cql_filter=(Data_col<‘03/21//2018’ and id=2)

When I try this URI from my web-browser only the first restriction is taken into account, and when I try to sent it from JAVA as an HTTP request I get a URI malformed error.

I have tried adding single quotes around all the elements, adding or eliminating spaces between words, and anything else that could cross my mind but nothing seems to be working.

I have full control over the format of the URI so I can replace anything with the corresponding special character if that would help.

I am not sure if I am making an obvious mistake or not, but I would be greatful for any help.

Best regards,
Maria.


Check out the vibrant tech community on one of the world’s most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ian Turton