AVSearchSortBuilder Class Reference

Inherits from NSObject
Declared in AVSearchSortBuilder.h

Overview

应用搜索的排序对象产生器

  sortFields

@property (nonatomic, strong, readonly) NSMutableArray *sortFields

+ newBuilder

新建 AVSearchSortBuilder 实例

+ (instancetype)newBuilder

Return Value

AVSearchSortBuilder 实例

Discussion

新建 AVSearchSortBuilder 实例

Declared In

AVSearchSortBuilder.h

– orderByAscending:withMode:andMissing:

按照key升序排序

- (void)orderByAscending:(NSString *)key withMode:(NSString *)mode andMissing:(NSString *)missing

Parameters

key

排序的key

mode

数组或者多值字段的排序模式,min表示取最小值,max取最大值,sum取综合,avg取平均值,默认值是avg

missing

当搜索匹配的文档没有排序的key的时候,设置本选项决定文档放在开头还是末尾,取值是"last"或者"first",默认是"last"表示在末尾

Discussion

按照key升序排序

Declared In

AVSearchSortBuilder.h

– orderByAscending:withMode:

- (void)orderByAscending:(NSString *)key withMode:(NSString *)mode

Declared In

AVSearchSortBuilder.h

– orderByAscending:

- (void)orderByAscending:(NSString *)key

Declared In

AVSearchSortBuilder.h

– orderByDescending:withMode:andMissing:

按照key降序排序

- (void)orderByDescending:(NSString *)key withMode:(NSString *)mode andMissing:(NSString *)missing

Parameters

key

排序的key

mode

数组或者多值字段的排序模式,min表示取最小值,max取最大值,sum取综合,avg取平均值,默认值是avg。

missing

当搜索匹配的文档没有排序的key的时候,设置本选项决定文档放在开头还是末尾,取值是"last"或者"first",默认是"last"表示在末尾。

Discussion

按照key降序排序

Declared In

AVSearchSortBuilder.h

– orderByDescending:withMode:

- (void)orderByDescending:(NSString *)key withMode:(NSString *)mode

Declared In

AVSearchSortBuilder.h

– orderByDescending:

- (void)orderByDescending:(NSString *)key

Declared In

AVSearchSortBuilder.h

– whereNear:point:inOrder:withMode:andUnit:

按照地理位置信息远近排序,key对应的字段类型必须是GeoPoint。

- (void)whereNear:(NSString *)key point:(AVGeoPoint *)point inOrder:(NSString *)order withMode:(NSString *)mode andUnit:(NSString *)unit

Parameters

key

排序的字段key

point

GeoPoint经纬度对象

order

排序顺序,升序"asc",降序"desc",默认升序,也就是从近到远。

mode

数组或者多值字段的排序模式,min表示取最小值,max取最大值,avg取平均值,默认值是avg。

unit

距离单位,"m"表示米,"cm"表示厘米,"mm"表示毫米,"km"表示公里,"mi"表示英里,"in"表示英寸,"yd"表示英亩,默认"km"。

Discussion

按照地理位置信息远近排序,key对应的字段类型必须是GeoPoint。

Declared In

AVSearchSortBuilder.h

– whereNear:point:inOrder:

whereNear:point:inOrder:withMode:andUnit

- (void)whereNear:(NSString *)key point:(AVGeoPoint *)point inOrder:(NSString *)order

Declared In

AVSearchSortBuilder.h

– whereNear:point:

whereNear:point:inOrder:withMode:andUnit

- (void)whereNear:(NSString *)key point:(AVGeoPoint *)point

Declared In

AVSearchSortBuilder.h