Opened 21 years ago

Closed 20 years ago

#450 closed defect (fixed)

WFS filters with PropertyIsLike

Reported by: doug@… Owned by: assefa
Priority: high Milestone: 4.4 release
Component: WFS Server Version: 4.1
Severity: normal Keywords:
Cc:

Description

The following requests of the itasca data returns incorrect results:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"
service="WFS" version="1.0.0" outputFormat="GML2" maxFeatures="100">
<wfs:Query typeName="lakespy2">
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsLike wildCard="*" singleChar="#" escape="!">
<ogc:PropertyName>LAKE_NAME</ogc:PropertyName>
<ogc:Literal>TROUT*</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>LAKE_NAME</ogc:PropertyName>
<ogc:Literal>JESSIE</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

.. returns one record (JESSIE). should return nothing.

<?xml version="1.0" encoding="UTF-8"?>
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"
service="WFS" version="1.0.0" outputFormat="GML2" maxFeatures="100">
<wfs:Query typeName="lakespy2">
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsLike wildCard="*" singleChar="#" escape="!">
<ogc:PropertyName>LAKE_NAME</ogc:PropertyName>
<ogc:Literal>TROUT*</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>LAKE_NAME</ogc:PropertyName>
<ogc:Literal>JESSIE</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>


.. returns one record (JESSIE). should return JESSIE and multiple records
starting with TROUT.

Doug

Change History (6)

comment:1 by dmorissette, 21 years ago

Cc: assefa@… added

comment:2 by assefa, 21 years ago

BBOX and PropertyIslIke current support :

The BBOX is only supposed to work with the AND and should fail with the OR. It 
is a limitation of the implementation.  When you have a BBOX AND 
OTHER_FILTER : the resulting in mapserver is as follows :

  It creates ONE class and sets that the expression with the OTHER_FILTER and 
then does a query using the BBOX. It has the effect of doing and AND. It can 
not do an OR in this case.



The same for PropertyIsLike : It only works with an OR : example 
FILTER=<Filter><OR><PropertyIsLike wildCard="*" singleChar="." 
escape="!"><PropertyName>NAME</PropertyName><Literal>Syd*</Literal></PropertyIs
Like><PropertyIsEqualTo><PropertyName>NAME</PropertyName><Literal>Digby</Litera
l></PropertyIsEqualTo></OR></Filter>
  will create :

   - one class with the expression for the PropertyisLike /Syd[a-z,A-Z]*/  and 
sets the classitem element to NAME
   - creates a second class and set the expression to ('[NAME]' = 'Digby')

  This has the effect of doing an OR.



 Note also that for both BBOX and PropertyIsLike, there can not be more than 
one filter of that kind : for example you can not have :
  FILTER=<Filter>
           <OR>
            <PropertyIsLike wildCard="*" singleChar="." escape="!">
               <PropertyName>NAME</PropertyName>
               <Literal>Syd*</Literal>
            </PropertyIsLike>
           </OR>
            <PropertyIsLike wildCard="*" singleChar="." escape="!">
               <PropertyName>POP_RANGE</PropertyName>
               <Literal>1*</Literal>
            </PropertyIsLike>
        </Filter>
  It would not work since there is only one CLASSITEM that can be specified in 
a layer and in this case you can you would need 2 class items NAME and 
POP_RANGE.


 For the BBOX, there is only one rectangular query which is done so 2 BBOX 
would not work.

comment:3 by dmorissette, 21 years ago

Should we not return an exception when an invalid filter is passed instead of
returning an incorrect response?

comment:4 by dmorissette, 21 years ago

typo... instead of "invalid filter" above I should have written "unsupported
filter"...

comment:5 by dmorissette, 20 years ago

Cc: morissette@… added; assefa@… removed
Milestone: 4.4 release
Owner: changed from morissette@… to assefa

comment:6 by assefa, 20 years ago

Resolution: fixed
Status: newclosed
The limitation has been removed few months back. it should work as expected. 
Closing the bug. If there are any specific issues left please reopen.
Note: See TracTickets for help on using tickets.