Thanks Justin,

I tried your suggestion with a slight change to the expression and it works now.

<wfs:Query typeName="store:VILLAGES">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:Literal>true</ogc:Literal>
<ogc:Function name="isLike">
<ogc:PropertyName>DISTRICT_NAME</ogc:PropertyName>
<ogc:Literal>(?i)sW(.)*</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>


when i look at the SQL that geoserver is submitting, it is simply a select * from the table, so i'm guessing geoserver will be do the filtering itself (as confirmed by Andrea just now).. so i guess its not great for large datasets. Also the nice OpenLayers filter manufacturer can't build this which means the map code has to get a bit less simple.

regarding Jira, my 2c is that propertyIsLike should be similar to isEqualTo and notEqualTo and give you a convienent way to ignore case, as people using the LIKE function are generally looking to be inclusive.. and it would be easier for 3rd party tools generating filter XML (eg OL). i realise all this is not in the wfs spec tho.

maybe this is mentioned here ?  http://jira.codehaus.org/browse/GEOT-2603


anyway, thanks for the assistance !

regards,

-i





On 29/09/10 4:46 PM, Justin Deoliveira wrote:
Hi Ivan,

Thanks for the info. So even though http://jira.codehaus.org/browse/GEOT-2396 states the same issue I don't think the patch applied there actually fixes the issue. The filter parser is not set up to handle two functions in this way. And actually the underlying geotools api will not allow us to create a PropertyIsLike filter in this way as far as I can tell. So fixing this would take some changes there as well.

However I think you may be may be able to accomplish the same thing with the "isLike" function. Something like this:

<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:Literal>true</ogc:Literal>
<ogc:Function name="isLike">
<ogc:PropertyName>DISTRICT_NAME</ogc:PropertyName>
<ogc:Literal>(i?)SW*</ogc:Literal>
</ogc:Function>
</ogc:PropertyIsEqualTo>
</ogc:Filter>

Let us know if it works. Also feel free to open a new jira about supporting two functions in a PropertyIsLike. Although it technically would not be schema valid.

-Justin


On Tue, Sep 28, 2010 at 8:19 AM, Ivan Price <ivan.pr...@acted.org <mailto:ivan.pr...@acted.org>> wrote:

    Hey Justin, certainly..  the layer is an oracle (XE) table, the
    store being a normal oracle store (NG).  I notice my stack trace
    says '65 more' which may be useful to you, but i'm not sure how to
    get the rest outputted.

    let me know if theres anything further i can provide.

    cheers,

    -i



    java.lang.RuntimeException: Parsing failed for PropertyIsLike:
    java.lang.NullPointerException
        at
    org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:158)
        at
    
org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:215)
        at
    org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:181)
        at
    
org.geotools.xml.impl.ElementHandlerImpl.endElement(ElementHandlerImpl.java:222)
        at
    org.geotools.xml.impl.ParserHandler.endElement(ParserHandler.java:607)
        at
    org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at
    org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
    Source)
        at
    
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
    Source)
        at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
    Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
    Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
    Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
    Source)
        at org.geotools.xml.Parser.parse(Parser.java:223)
        at
    org.geoserver.wfs.xml.v1_1_0.WfsXmlReader.read(WfsXmlReader.java:91)
        at
    org.geoserver.ows.Dispatcher.parseRequestXML(Dispatcher.java:1180)
        at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:466)
        at
    org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:227)
        at
    
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
        at
    
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
        at
    
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
        at
    
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
        at
    
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
        at
    
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
    
org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
    
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
        at
    
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
        at
    
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
        at
    
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
        at
    
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
        at
    
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
        at
    
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
        at
    
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
        at
    
org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
        at
    
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
        at
    
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
        at
    
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
        at
    org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
        at
    org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
        at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
    org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
        at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
    
org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
        at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
        at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
    
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
    
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
    
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
    
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
    
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
        at
    
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.NullPointerException
        at
    
org.geotools.filter.v1_0.OGCPropertyIsLikeTypeBinding.parse(OGCPropertyIsLikeTypeBinding.java:107)
        at
    org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:149)
        ... 65 more





    On 28/09/10 3:58 PM, Justin Deoliveira wrote:
    Hi ivan,

    Can you include the full stack trace? Also what type of layer is
    this being used against? Shapefile or database or ... ? Thanks.

    -Justin

    On Mon, Sep 27, 2010 at 9:30 AM, Ivan Price <ivan.pr...@acted.org
    <mailto:ivan.pr...@acted.org>> wrote:


        Hi there,

        I'm trying to implement a case insenstive LIKE filter by
        applying the
        "strToUpperCase" function to my Literal like this:

        <wfs:GetFeature service="WFS" version="1.1.0"
        xsi:schemaLocation="http://www.opengis.net/wfs
        http://schemas.opengis.net/wfs/1.1.0/wfs.xsd";>
        <wfs:Query typeName=store:VILLAGES">
        <ogc:Filter>
        <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
        <ogc:Function name="strToUpperCase">
        <ogc:PropertyName>DISTRICT_NAME</ogc:PropertyName>
        </ogc:Function>
        <ogc:Function name="strToUpperCase">
        <ogc:Literal>SW*</ogc:Literal>
        </ogc:Function>
        </ogc:PropertyIsLike>
        </ogc:Filter>
        </wfs:Query>
        </wfs:GetFeature>

        but am getting a null pointer exception:

        java.lang.RuntimeException: Parsing failed for PropertyIsLike:
        java.lang.NullPointerException
        Parsing failed for PropertyIsLike: java.lang.NullPointerException
        null

        i'm guessing as described here:
        http://jira.codehaus.org/browse/GEOT-2396

        i note that the above bug was reported as being fixed in
        geotools a
        while ago, but the problem seems to still exist for me in
        geoserver.  am
        i doing something wrong here, or is it coming in future
        geoserver releases ?

        i'm using geoserver 2.0.2.

        thanks very much for everything as always,

        -ivan

        ACTED.org







        
------------------------------------------------------------------------------
        Start uncovering the many advantages of virtual appliances
        and start using them to simplify application deployment and
        accelerate your shift to cloud computing.
        http://p.sf.net/sfu/novell-sfdev2dev
        _______________________________________________
        Geoserver-users mailing list
        Geoserver-users@lists.sourceforge.net
        <mailto:Geoserver-users@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/geoserver-users




-- Justin Deoliveira
    OpenGeo - http://opengeo.org
    Enterprise support for open source geospatial.




--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to