FindOptions.SearchContext Property
FindOptions.SearchContext Property
The number representing the Entity.ID property of the geographic area to which the search should be limited. Overrides the UserInfoFindHeader.Context property.
Public SearchContext As System.Integer
[C#]
public System.Int32 SearchContext;
Remarks
For the FindServiceSoap.Find method, a number representing any valid entity ID is accepted. To find the Entity.ID property of a particular place (such as a state or city), do a find on that place name; the Location.Entity property of the found location (FindResult.FoundLocation property) includes the entity ID.
Using the SearchContext property allows you to limit the results and speed the search process. The more limited the context, the faster the search.
The SearchContext property is ignored when passed in the FindAddressSpecification.Options , FindByIDSpecification.Options , FindByPropertySpecification.Options , FindNearbySpecification.Options , and FindNearRouteSpecification.Options properties.
Example
[Visual Basic]
'Search in only Canada
Dim findSpec As New FindSpecification()
findSpec.DataSourceName = "MapPoint.NA"
findSpec.InputPlace = "Vancouver"
findSpec.Options = New FindOptions()
findSpec.Options.SearchContext = 39
Dim foundResults As FindResults
foundResults = findService.Find(findSpec)
Dim fr As FindResult
For Each fr In foundResults.Results
Console.WriteLine(fr.FoundLocation.Entity.DisplayName)
Next
[C#]
//Search in only Canada
FindSpecification findSpec = new FindSpecification();
findSpec.DataSourceName = "MapPoint.NA";
findSpec.InputPlace = "Vancouver";
findSpec.Options = new FindOptions();
findSpec.Options.SearchContext = 39;
FindResults foundResults;
foundResults = findService.Find(findSpec);
foreach(FindResult fr in foundResults.Results)
{
Console.WriteLine(fr.FoundLocation.Entity.DisplayName);
}
See Also
FindOptions Class | Entity.ID Property | UserInfoFindHeader.Context Property | FindServiceSoap.Find Method | FindResult.FoundLocation Property