GMSPlaceSearchByTextRequest 类参考

GMSPlaceSearchByTextRequest 类参考

概览

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

公共成员函数

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

属性

NSString * includedType
 默认 init 不可用。
 返回的结果数上限。允许值介于 1 到 20 之间。
int maxResultCount
float 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/maps/documentation/places/ios-sdk/data-fields

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

返回的结果数上限。允许值介于 1 到 20 之间。

您可以在 https://developers.google.com/maps/documentation/places/ios-sdk/text-search 上找到此字段的允许范围。

默认值为上限。

-(浮点数)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]

要搜索的受限区域。

此位置具有限制条件,这意味着系统不会返回指定位置以外的结果。

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

无法与 locationBias 一起使用。

文本搜索的 locationRestriction 仅支持 GMSPlaceRectAngularLocationOption。