public class SearchRequest extends DiscoveryRequest
SearchRequest
processes text string queries based on the user's input to find
specific places. It answers questions of "what" and "where" for an online search of POI or
address.
The results of the SearchRequest
are sets of places that match a user's search term in a
specific location context (such as near a given location, around a user's current position or on
the currently visible map).
A search location context must be provided by setting a search center location using
setSearchCenter(GeoCoordinate)
or a bounding map viewport using
DiscoveryRequest.setMapViewport(GeoBoundingBox)
or both. Failing to set a location context will
result in an ErrorCode.INVALID_PARAMETER
when executing the request.
BUILDING_ID_REFERENCE_NAME, PLACE_CONTENT_WIKIPEDIA, PVID_ID_REFERENCE_NAME, VENUES_CONTENT_ID_REFERENCE_NAME, VENUES_DESTINATION_ID_REFERENCE_NAME, VENUES_ID_REFERENCE_NAME, VENUES_VENUE_ID_REFERENCE_NAME
Constructor and Description |
---|
SearchRequest(java.lang.String query)
SearchRequest constructor
|
Modifier and Type | Method and Description |
---|---|
ErrorCode |
execute(ResultListener<DiscoveryResultPage> listener)
Executes an asynchronous request.
|
SearchRequest |
setQueryText(java.lang.String query)
Set the search query text.
|
SearchRequest |
setSearchArea(GeoCoordinate center,
int radius)
Sets the search area using a center location and radius.
|
SearchRequest |
setSearchCenter(GeoCoordinate center)
Sets a
GeoCoordinate representing the location context used to search for results
that are appropriate to the query parameter. |
addBuildingFilter, addImageDimensions, addReference, getCollectionSize, getReferences, getRichTextFormatting, setCategoryFilter, setCollectionSize, setMapViewport, setRichTextFormatting, setSearchArea
public SearchRequest(java.lang.String query)
query
- Query text specifying the kind of places to locatepublic SearchRequest setSearchCenter(GeoCoordinate center)
GeoCoordinate
representing the location context used to search for results
that are appropriate to the query
parameter. Use this method to do worldwide search.
setSearchCenter
in class DiscoveryRequest
center
- A GeoCoordinate
representing the location context used to search for
results that are appropriate to the query
parameter.SearchRequest
public SearchRequest setSearchArea(GeoCoordinate center, int radius)
setSearchArea
in class DiscoveryRequest
center
- The GeoCoordinate
representing the search area center location.radius
- The search area circle radius in meters. Valid value for radius is (0, 21000000).SearchRequest
.java.lang.IllegalArgumentException
- if radius is less or equal to 0.public SearchRequest setQueryText(java.lang.String query)
query
- Query text specifying the kind of places to locateSearchRequest
public ErrorCode execute(ResultListener<DiscoveryResultPage> listener)
execute
in class DiscoveryRequest
listener
- A ResultListener
passed along with the request to monitor progressErrorCode
representing an appropriate result