SearchByTextRequest

public abstract class SearchByTextRequest implements Request


Request used by searchByText.

Summary

Nested types

public abstract class SearchByTextRequest.Builder

Builder for SearchByTextRequest.

How results will be ranked in the response.

Public constructors

Public methods

static SearchByTextRequest.Builder
builder(String textQuery, List<Place.Field> placeFields)
abstract @Nullable String

Returns the requested place type.

abstract @Nullable LocationBias

Returns the biased region to search.

abstract @Nullable LocationRestriction

Returns the restricted region to search.

abstract @Nullable Integer

Returns the maximum number of results to return.

abstract @Nullable @FloatRange(from = Place.RATING_MIN_VALUE, to = Place.RATING_MAX_VALUE) Double

Returns the minimum average user rating for places to be included in the results.

abstract List<Place.Field>

Returns the Fields that should be included in the place results.

abstract @IntRange(from = Place.PRICE_LEVEL_MIN_VALUE, to = Place.PRICE_LEVEL_MAX_VALUE) List<Integer>

Returns the price levels of places that should be included in the results.

abstract @Nullable SearchByTextRequest.RankPreference

Returns the RankPreference.

abstract @Nullable String

The unicode country/region code (CLDR) of the location where the request is coming from.

abstract String

Returns the text query for the search.

abstract boolean

Returns whether results should be restricted to places that are currently open.

abstract boolean

Returns whether only results of getIncludedType should be returned.

static SearchByTextRequest
newInstance(String textQuery, List<Place.Field> placeFields)

Public constructors

SearchByTextRequest

public SearchByTextRequest()

Public methods

builder

public static SearchByTextRequest.Builder builder(String textQuery, List<Place.Field> placeFields)

getIncludedType

public abstract @Nullable String getIncludedType()

Returns the requested place type.

A list of supported types can be found in .

See new Table A and B for the most up-to-date list of supported types available to searchByText.

getLocationBias

public abstract @Nullable LocationBias getLocationBias()

Returns the biased region to search.

This location serves as a bias, which means there is a preference for results in the given location.

Location restriction and location bias cannot be set at the same time. Only one should be set per request.

If you omit both location bias and location restriction, then the request uses IP biasing by default. With IP biasing, the request uses the device's IP address to bias the results.

getLocationRestriction

public abstract @Nullable LocationRestriction getLocationRestriction()

Returns the restricted region to search.

This location serves as a restriction which means results outside the given location will not be returned.

The LocationRestriction for SearchByTextRequest only supports RectangularBounds type.

Location restriction and location bias cannot be set at the same time. Only one should be set per request.

If you omit both location bias and location restriction, then the request uses IP biasing by default. With IP biasing, the request uses the device's IP address to bias the results.

getMaxResultCount

public abstract @Nullable Integer getMaxResultCount()

Returns the maximum number of results to return. It must be between 1 and 20 (default), inclusively.

getMinRating

public abstract @Nullable @FloatRange(from = Place.RATING_MIN_VALUE, to = Place.RATING_MAX_VALUE) Double getMinRating()

Returns the minimum average user rating for places to be included in the results.

getPlaceFields

public abstract List<Place.FieldgetPlaceFields()

Returns the Fields that should be included in the place results.

getPriceLevels

public abstract @IntRange(from = Place.PRICE_LEVEL_MIN_VALUE, to = Place.PRICE_LEVEL_MAX_VALUE) List<IntegergetPriceLevels()

Returns the price levels of places that should be included in the results.

Any combination of price levels can be chosen; default is all price levels.

  • 0 - PRICE_LEVEL_FREE
  • 1 - PRICE_LEVEL_INEXPENSIVE
  • 2 - PRICE_LEVEL_MODERATE
  • 3 - PRICE_LEVEL_EXPENSIVE
  • 4 - PRICE_LEVEL_VERY_EXPENSIVE

getRankPreference

public abstract @Nullable SearchByTextRequest.RankPreference getRankPreference()

Returns the RankPreference.

The API uses RELEVANCE by default when applicable. For example, for a query such as "Restaurants in New York City" then RELEVANCE is the default. For geographical queries, such as "Mountain View, CA", or other type of queries then no default is applied.

getRegionCode

public abstract @Nullable String getRegionCode()

The unicode country/region code (CLDR) of the location where the request is coming from.

The region may affect the format and type of data returned.

See Territory Containment for region codes.

getTextQuery

public abstract String getTextQuery()

Returns the text query for the search.

isOpenNow

public abstract boolean isOpenNow()

Returns whether results should be restricted to places that are currently open.

isStrictTypeFiltering

public abstract boolean isStrictTypeFiltering()

Returns whether only results of getIncludedType should be returned.

Default value is false.

newInstance

public static SearchByTextRequest newInstance(String textQuery, List<Place.Field> placeFields)