Saul,

I noticed this too. I added the SQL92 like-encoder a little while ago and tested in in postgis. I dont have oracle, mysql, or SDE here to test, so I didnt add it to them. I did, however, send a message out asking folks to test and add it to the filter capabilities if it worked.

I think there might be a probably with how mysql deals with "like" queries, but I'm not sure.

dave
ps. Add the like-filter-to-SQL encoder just to do feature searching! You can see it in action here: http://sigma.openplans.org

Saul Farber wrote:

Hello all,

So I'm creating a community-mapbuilder application, and I think to myself, "hey, I'll have a 'search' feature here'.

I create the page, have it submit a filter like this to my SDE-backed geoserver featureCollection:

<Filter>
<PropertyIsLike wildcard,singlechar,escape>
<PropertyName>STREET_NAME</PropertyName>
<Literal>%MAIN%</Literal>
</PropertyIsLike>
</Filter>


However, it gives me back EVERY feature in the collection.

Hmm. I try a few different things, but while it's definitely getting the LIKE filter into its internal Query representation: (here's a log snippit)


[FINE] org.vfny.geoserver.wfs.responses.FeatureResponse - Query is
  Query []
   feature type: massgis:GISDATA.NAVTEQRDS_ARC
   filter: [ ST_NAME is like %MAIN% ]
   [properties: ST_NAME]
 To gt2: Query: []
   feature type: GISDATA.NAVTEQRDS_ARC
   filter: [ ST_NAME is like %MAIN% ]
   [properties: ST_NAME]


It's just NOT working.


So I delve a bit deeper, and have the ArcSDEQuery tell me what filter it's using. In getSeSQLConstruct() there's a test like this (around line 983):

if (!Filter.NONE.equals(sqlFilter)) {
    ...get the where clause for this query...
}

So I added an else to this if statement like so:

else {
    LOGGER.warning("Filter was 'FILTER.NONE'");
}


Lo-and-behold, the line "Filter was 'FILTER.NONE'" appears in my log.

Weird! This is totally a supported filter as far as SDE is concerned...why wouldn't it be showing up?

So I trace back and up through the geotools stack, and discover than in the base-class org.geotools.filter.SQLEncoder on line 175 (also in GT-2.2.x, by the way) the method "createFilterCapabilities()" creates the default filter capabilities for a generic SQL encoder...and *doesn't include* LIKE as a supported filter.

I went and added the line:

capabilities.addType(AbstractFilter.LIKE);

to that method, and everything worked just fine for me.



After all that, my question is as follows:

* Is this intentional? Is 'LIKE' excluded from the default filter capabilities because some query engines just don't support 'LIKE' at all? Or is this an oversight?


If it's an oversight, I can provide a patch to 2.2.x and 2.1.x quickly...it's a one-liner.


If it's NOT an oversight, I can provide a patch to 2.2.x and 2.1.x to get SDE support for LIKE filters, because (after all) it *does* in-fact support them.


Anyone else bumped into this?

--saul


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to