GLSearch
@interface GLSearch : NSObject
GLSearch class contains a set of parameters that defines search in offline maps
-
Undocumented
Declaration
Objective-C
- (instancetype _Nullable)initFromJSON:(NSString *)json; -
Adds set of tile hashes to use for search (child tiles will be skipped)
Declaration
Objective-C
- (void)setTiles:(nonnull NSSet<NSNumber *> *)tiles;Parameters
tilesSet of tile hashes
-
Sets locale settings that used to sort results by importance. Results in user language displayed on top.
Declaration
Objective-C
- (void)setLocaleSettings:(nonnull GLMapLocaleSettings *)localeSettings;Parameters
localeSettingsLanguage priority settings.
-
Adds filter to search. Result of search will contain objects that matches all filters
Declaration
Objective-C
- (void)addFilter:(nonnull GLSearchFilter *)filter;Parameters
filterfilter to add.
-
Sets maximum number of results to fetch from map
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) NSUInteger limit; -
Sets center of search. Distance from this center will define importance of object. Usually center is user location or center of the screen.
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) GLMapPoint center; -
Sets bounding box where search will be performed
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) GLMapBBox bbox; -
Set this value to
YESif you plan to get address of objects. Loading address after search is much faster (cache reuse, bulk loading)Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) BOOL needEnclosingAreas; -
Types of object
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) GLMapVectorObjectType objectTypes; -
Performs search synchronysly
Declaration
Objective-C
- (nonnull GLMapVectorObjectArray *)search; -
Starts search.
Declaration
Objective-C
- (void)searchAsyncWithCompletionBlock: (nonnull GLSearchCompletionBlock)completionBlock;Parameters
completionBlockBlock will be called when search is finished.
-
Merges search results with custom objects
Declaration
Objective-C
- (nonnull NSArray *)mergeSearchResults: (nonnull GLMapVectorObjectArray *)searchResults withCustomObjects:(nonnull NSArray *)customObjects using:(nonnull GLSearchInfoBlock)infoBlock;Parameters
searchResultsSearch results array
customObjectsArray of custom objects
infoBlockBlock that returns location, category and extra score for custom object
Return Value
Returns sorted array
-
Cancels search operation.
Declaration
Objective-C
- (void)cancel; -
Undocumented
Declaration
Objective-C
- (NSString *)toJSON; -
Splits string into words with rules that was used to generate search indexes. Uses ICU inside. Works even for Japanese glyphs without spaces.
Declaration
Objective-C
+ (nonnull NSArray<NSString *> *)splitByWords:(nonnull NSString *)string;Parameters
stringString with long text
Return Value
Returns array of words
-
Finds nearest vector object to some location on map.
Declaration
Objective-C
+ (GLMapVectorObject *_Nullable) nearestToPoint:(GLMapPoint)point maxDistance:(double)distance withFilters:(NSArray<GLSearchFilter *> *_Nullable)filters;Parameters
pointPoint
distanceMaximum distance from point
filtersSearch filters applied to results
Return Value
Returns vector object or nil if nothing found in distance radius
Install in Dash
GLSearch Class Reference