On 15-12-15 10:04, Andrea Aime wrote: > Hi Mark, > quick check, have you tried writing "ID" instead of ID in your CQL? >
Had not tried that, changing ID IN to "ID" IN gives me an OR Filter like [[ id = 15 ] OR [ id = 30 ] OR [ id = 31 ] OR [ id = 32 ] OR.... but somehow I'm ending up with an EXCLUDE filter in our application in the end...not sure why yet. As an aside the exclude filter, once serialized, becomes cql (["id = 1 and id <> 1"]) is not parsable because it has id unquoted making it invalid. > On Tue, Dec 15, 2015 at 9:46 AM, Mark Prins <[email protected] > <mailto:[email protected]>> wrote: > > Hi all, > I just want to check this with you; > > I have a (postgis) table with fields > <ID>, <GEOM>, <PK_KEY>, <TIMESTAMP>,... > that is joined to a view (on <ID>) in our application to provide > filtering based on the column of the view, eg. the value of a > <STATUS>, this filter is then created as a CQL statement having an > IN query like: ID IN > ((7494,8882,8227,7497,8883,7499,6774,7498,14880,17584,14782,7349,... > the filter is then stored in the client session to be provided to > geoserver as a SLD which looks something like: > > <?xml version="1.0" encoding="UTF-8"?> > <sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" > xmlns:sld="http://www.opengis.net/sld" > xmlns:ogc="http://www.opengis.net/ogc" > xmlns:gml="http://www.opengis.net/gml" version="1.0.0"> > <sld:NamedLayer> > <sld:Name>parcels</sld:Name> > <sld:LayerFeatureConstraints> > <sld:FeatureTypeConstraint> > <sld:FeatureTypeName>parcels</sld:FeatureTypeName> > <ogc:Filter> > <ogc:FeatureId fid="7494" /> > <ogc:FeatureId fid="8882" /> > <ogc:FeatureId fid="8227" /> > <ogc:FeatureId fid="7497" /> > <ogc:FeatureId fid="8883" /> > <ogc:FeatureId fid="7499" /> > <ogc:FeatureId fid="6774"... > > > As you can see the CQL is transformed to a filter with FeatureId > which in turn gives an unexpected result in the map, because the CQL > we had was asking for the values of ID (and not PK_KEY (FID) values) > > Looking at ECQLParser the result is logical; my CQL is eventually > handled by the IdPredicateDeprecated() method to generate the FID > filter, basically making it impossible to use a field named ID with > an IN query (unless ID is also primary key). > > Now for my question: is there any way around this? I can think of: > - renaming the <ID> field in the table, > - rewriting our filter creation logic to produce a list of <PK_KEY> > values instead of a list of <ID> values > - rewriting or filter logic to produce a much more verbose list of OR's > > But there might be other ways out? > Mark > ------------------------------------------------------------------------------ _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
