GMSPlaceSearchByTextRequest 类参考

GMSPlaceSearchByTextRequest 类参考

概览

表示要通过 GMSPlacesClient 发送的文本搜索请求定义。

公开成员函数

(instancetype)- initWithTextQuery:placeProperties:
 使用文本查询和要返回的地点属性实例化 GMSPlaceSearchByTextRequest

属性

NSString * includedType
 默认 init 不可用。
整数maxResultCount
 要返回的结果数上限。
浮点数minRating
 要包含在结果中的地点的最低平均用户评分。
BOOL isOpenNow
 过滤搜索结果,以显示当前正在营业的地点。
NSArray<GMSPlaceProperty >*placeProperties
 应包含在地点结果中的 GMSPlaceProperty 数组。
NSArray<NSNumber * >*priceLevels
 GMSPlacesPriceLevel 值的数组,应过滤结果中包含的地点。
GMSPlaceSearchByTextRankPreferencerankPreference
 GMSPlaceSearchByTextRankPreference,用于对请求返回的结果进行排序。
NSString * regionCode
 请求来源位置的 Unicode 国家/地区代码 (CLDR)。
BOOL isStrictTypeFiltering
 定义是否仅应返回 includedType 的结果。
NSString * textQuery
 搜索的文本查询。
ID<GMSPlaceLocationBias >locationBias
 要搜索的自定义区域。
ID<GMSPlaceLocationRestriction >locationRestriction
 要搜索的受限区域。

成员函数文档

- (instancetype) initWithTextQuery: (NSString *)  textQuery
placeProperties: (NSArray< GMSPlaceProperty > *) placeProperties

使用文本查询和要返回的地点属性实例化 GMSPlaceSearchByTextRequest

参数:
textQuery搜索请求的字符串查询。
placeProperties应包含在地点结果中的 GMSPlaceProperty 数组。不得为空。如果列表为空,将导致尝试发送请求时出错。

属性说明

- (NSString*) includedType [read, write, copy]

默认 init 不可用。

请使用指定的初始化程序。所请求的地点类型。

如需查看可用支持类型的最新列表,请参阅 https://developers.google.com/maps/documentation/places/web-service/search-textual#supported-types

-(整数)maxResultCount [read, write, assign]

返回的结果数上限。

允许 1 到 20 之间的值。

如需了解此字段的允许范围,请访问 https://developers.google.com/maps/documentation/places/web-service/search-textual#maxresultcount

默认值为上限。

-(浮点数)minRating [read, write, assign]

要包含在结果中的地点的最低平均用户评分。

评分必须介于 0.0 到 5.0 之间。

指定的评分将四舍五入到最接近的 0.5。请参阅 GMSPlace 评分属性。

默认值为 0.0。

- (BOOL) isOpenNow [read, write, assign]

过滤搜索结果,以显示当前正在营业的地点。

默认值为 true。

- (NSArray<GMSPlaceProperty>*) placeProperties [read, assign]

应包含在地点结果中的 GMSPlaceProperty 数组。

- (NSArray<NSNumber *>*) priceLevels [read, write, assign]

GMSPlacesPriceLevel 值的数组,应过滤结果中包含的地点。

可以选择任意价位组合;默认为所有价位。

- (GMSPlaceSearchByTextRankPreference) rankPreference [read, write, assign]

GMSPlaceSearchByTextRankPreference,用于对请求返回的结果进行排序。

- (NSString*) regionCode [read, write, copy]

请求来源位置的 Unicode 国家/地区代码 (CLDR)。

区域可能会影响所返回数据的格式和类型。如果您不提供任何代码,我们将不会偏向于任何国家/地区。

有关区域代码,请参阅 https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html

- (BOOL) isStrictTypeFiltering [read, write, assign]

定义是否仅应返回 includedType 的结果。

默认值为 false。

- (NSString*) textQuery [read, copy]

搜索的文本查询。

- (id<GMSPlaceLocationBias>) locationBias [read, write, assign]

要搜索的自定义区域。

此位置起到偏向作用,表示给定位置的结果具有优先权。

执行搜索请求时,必须设置 locationRestriction 或 locationBias。

如果同时设置 locationRestriction,此字段将被忽略。

- (id<GMSPlaceLocationRestriction>)locationRestriction [read, write, assign]GMSPlaceLocationRestriction

要搜索的受限区域。

此位置起到了限制作用,这意味着将不会返回指定位置以外的结果。

执行搜索请求时,必须设置 locationRestriction 或 locationBias。

不能与 locationBias 一起使用。

文本搜索的 locationRestriction 仅支持 GMSPlaceRectangularLocationOption。