You need to use a wild card in your like expression so something like:
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsLike
escapeChar="#">
<ogc:PropertyName>attr</ogc:PropertyName>
<ogc:Literal>%1,%</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:PropertyIsLike
escapeChar="#">
<ogc:PropertyName>attr</ogc:PropertyName>
<ogc:Literal>%15,%</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Or>
</ogc:Filter>
might work in more cases but will still fail if 1 or 15 are the last in the
list,
You could get more control using the filter function isLike as it allows
you to use the full java pattern matching
<https://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html>
<ogc:Filter>
<ogc:Function
name="isLike">
<ogc:PropertyName>attr</ogc:PropertyName>
<ogc:Literal>*15[^0-9]?</ogc:Literal>
</ogc:Function>
Ian
On 25 March 2016 at 10:45, Geoffrey <[email protected]> wrote:
> Hello,
>
> Let's say that I have a polygon with a text attribute "attr" containing a
> list of values separated by comma, like so for example : "1,15,19"
>
> I would like to filter like so : if the attribute contains else the value 1
> or 15 , then...
>
> I tried using PropertyIsLike and escapeChar:
>
> <ogc:Filter>
> <ogc:Or>
>
> <ogc:PropertyIsLike escapeChar=",">
>
> <ogc:PropertyName>attr</ogc:PropertyName>
>
> <ogc:Literal>1</ogc:Literal>
>
> </ogc:PropertyIsLike>
>
> <ogc:PropertyIsLike escapeChar=",">
>
> <ogc:PropertyName>attr</ogc:PropertyName>
>
> <ogc:Literal>15</ogc:Literal>
>
> </ogc:PropertyIsLike>
> </ogc:Or>
> </ogc:Filter>
>
> But it's not working. Any idea ?
>
> Thank you
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Filtering-on-an-attribute-containing-list-of-values-tp5258310.html
> Sent from the GeoServer - User mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
--
Ian Turton
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users