I am attempting to implement a search widget to search for a parcel ID on the map. The feature layer I am using has multiple rows per polygon based on what appraisal year we are interested in. For other query tasks I am able to specify a where clause that limits returned rows to a specific year. I do not seem to have that same level of control with the sources for the search widget.
Here is the search widget initiating code I am using;
var s = new Search({
enableButtonMode: true, //this enables the search widget to display as a single button
enableLabel: false,
enableInfoWindow: true,
showInfoWindowOnSelect: true,
map: map
}, "search");
Here is the source I am using to perform the search against the feature layer;
var sources = [];
sources.push({
featureLayer: new FeatureLayer("http://xxx.xxx.xxx/arcgis/rest/services/xxx/MapServer/1"),
searchFields: ["xxx.dbo.map_property_data_vw.prop_id"],
displayField: "xxx.dbo.map_property_data_vw.prop_id",
exactMatch: false,
name: "propSearch",
outFields: ["*"],
placeholder: "Enter a property ID...",
maxResults: 6,
maxSuggestions: 6,
infoTemplate: infoTemplateQuery,
enableSuggestions: false,
minCharacters: 2
});
s.set("sources", sources);
s.startup();
The search works as expected and opens to appropriate infoWindow, however the data displayed is not from the correct year, thus not providing the latest information in some cases. I have no control over the REST service, or I would just alter the query to be more suitable for this application.
I am hoping to implement something similar to how I filter other feature layer queries;
query.where = "xxx.dbo.map_property_data_vw.prop_val_yr = '" + 2015 + "'";
Is this possible, or should I be taking another approach?
Thank you in advance.
jw