The getByTextSearch query performs a text search for business names within the specified distance from the specified location. The location can be an address, a postal code, or a set of geographical coordinates.
This query is supported for the Places dataset only.
Query syntax:
getByTextSearch(
address: String
postalCode: String
searchText: String!
matchType: MatchType = EXACT
distance: Float = 1000
limit: Int = 50
longitude: Float
latitude: Float
): TextSearchRelationEntity| Parameter | Type | Required | Description |
|---|---|---|---|
| address | String | Optional | The address of the location the search will center on. |
| postalCode | String | Optional | If entered, the search will be restricted to the area in the specified postal code, within the specified distance from the postal code center. |
| searchText | String | Required | The text you are searching on. |
| matchType | String | Optional | Search for business names using Fuzzy or Exact matching. Can be:
|
| distance | Float | Optional | If entered, the search will be limited to the specified distance from the input location. Distance is measured in meters. The default is 1000 meters. The longest allowable distance is 5000 meters. |
| limit | Integer | Optional | The most business names that will be returned. The default behavior is to return all businesses that match the search criteria. |
| longitude | Float | Optional | The longitude coordinate of the location the search will center on. Required if latitude is entered. |
| latitude | Float | Optional | The latitude coordinate of the location the search will center on. Required if longitude is entered. |
Example 1
The example query below returns businesses with names similar to "STBUCKS" that are located within 2000 meters of the coordinates 47.8637, -122.2679.
{
getByTextSearch(
searchText: "STBUCKS"
matchType: FUZZY
longitude: -122.2679
latitude: 47.8637
distance: 2000
) {
places {
data {
brandName
groupName
franchiseName
tradeName
}
}
}
}Example 2
The example below returns businesses with names similar to "STBUCKS" that are located within 1000 meters of the input address.
{
getByTextSearch(
address: "10460 E 29th Dr Denver, CO"
searchText: "STBUCKS"
matchType: FUZZY
distance: 1000
) {
places {
data {
brandName
groupName
franchiseName
tradeName
}
}
}
}
Example 3
This query returns businesses whose names fuzzy-match 'STBUCKS' and that are either located within the 98087 postal code area or within 3500 meters of the geographic center of postal code 98087.
{
getByTextSearch(
searchText: "STBUCKS"
matchType: FUZZY
postalCode: "98087"
distance: 3500
) {
places {
data {
brandName
groupName
franchiseName
tradeName
}
}
}
}