I have the following filter in OpenLayers 2.13
var filter_c = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LIKE,
property: 'p_name',
value: '%'+document.getElementById("nm").value+'%'
})
I also use GeoServer 2.1.3 and PostgreSQL 9.1 / PostGIS 2.0.
This filter is case sensitive and is applied to a vector layer. I can provide more code if you want.
I try to use ILIKE
instead of LIKE
but no luck. What am I missing? How can I make this filter case insensitive?
Here is the complete, original code
var filter_c = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LIKE,
property: 'p_name',
value: '%'+document.getElementById("nm").value+'%'
});
//pass the filter to the layer
var prot = new OpenLayers.Protocol.WFS({
url: "/geoserver/wfs",
featureType: "pins",
featureNS: "http://www.mysite.gr",
defaultFilter: filter_cl
});
var _CallBack = function(resp) {
pins.addFeatures(resp.features)
var cb = pins.features.length;
if (cb == 0){alert("Nothing Found");}
};
var response = prot.read({callback: _CallBack});
//refresh to render POIs
pins.refresh({force:true});
The pins
layer takes data from a table in postgreSQL/PostGIS. This table has id, name, geometry, category, etc.
Names are in UTF8
and are in Greek, such as Ακρόπολη, Παρθενώνας
etc.
I simply set it like pins = new OpenLayers.Layer.Vector("LayerTitle", {renderers: ["Canvas", "SVG", "VML"]})
and the I have the aforementioned code to search it