Searches the attributes of one or more layers in a data frame, in a map service for a given search string.
Find(MapDescription MapDescription, ImageDisplay MapImageDisplay, string SearchString, bool Contains, string SearchFields, esriFindOption FindOption, int[] LayerIDs)
Parameter |
Description |
MapDescription |
Used to define the map extent and visibility of layers. |
ImageDisplay |
Used to determine whether layers are visible or not based on the current map scale. |
SearchString |
The string value searched for during the find process. |
Contains |
Whether the attribute value contains the search string (true) or is an exact match (false). If true, the search is not case sensitive. If false, the search is case sensitive. |
SearchFields |
A comma delimited list of field names used during the search. If empty or null, all fields are searched. |
FindOption |
An enumeration is used to define whether all layers or only visible layers are searched. |
LayerIDs |
An array of layers ids for layers to search. If empty or null, all layers can be searched. |
Return Value
An array of MapServerFindResult objects,
one for each record that contains a match. If multiple fields in the same
record match the search string, only one MapServerFindResult referencing
the first matched field is returned.
Remarks
There are two key differences between the Find and the Map Service methods QueryFeatureCount, QueryFeatureCount2, QueryFeatureIDs, QueryFeatureIDs2, QueryFeatureData, and QueryFeatureData2:
Find can work with multiple layers while the query methods work with a single layer.
Find only requires a search string, whereas the query methods use a QueryFilter. This allows query methods to utilize either an attribute filter (SQL expression) or a spatial filter.
Layer visibility depends on whether the layer is on or off (the Visible property on a layers LayerDescription) or whether the layer is on, but not visible due to scale dependencies. Each layer maintains a LayerDescription available via the MapDescription.LayerDescriptions array. Scale dependency for a layer is available via the MinScale and MaxScale properties on MapLayerInfo, available via the MapServerInfo.MapLayerInfos array. The ImageDisplay parameter is used to determine layer visibility based on scale dependencies.
The amount of information (e.g. number of MapServerFindResult objects) returned from a call to the Find method may be restricted by the map service. The default maximum value for the number of results returned from a call to the Find method is 500. If 600 records are matched, only the first 500 results will be returned. The maximum number of results cannot be changed via the ArcGIS Server SOAP API. The map service itself must be configured to return more results, if necessary. If the maximum result limit has been reached, a technique to iterate through blocks of results is presented in the QueryFeatureIDs method remarks.
Examples