GLSearch


@interface GLSearch : NSObject

GLSearch class contains a set of parameters that defines search in offline maps

  • Initilaize GLSearch from json string

    Declaration

    Objective-C

    - (instancetype _Nullable)initFromJSON:(nonnull NSString *)json;

    Parameters

    json

    json string with paramters.

  • Adds set of tile hashes to use for search (child tiles will be skipped)

    Declaration

    Objective-C

    - (void)setTiles:(nonnull NSSet<NSNumber *> *)tiles;

    Parameters

    tiles

    Set 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

    localeSettings

    Language 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

    filter

    filter to add.

  • Sets maximum number of results to fetch from map

    Declaration

    Objective-C

    @property (nonatomic) 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) GLMapPoint center;
  • Sets bounding box where search will be performed

    Declaration

    Objective-C

    @property (nonatomic) GLMapBBox bbox;
  • Set this value to YES if you plan to get address of objects. Loading address after search is much faster (cache reuse, bulk loading)

    Declaration

    Objective-C

    @property (nonatomic) BOOL needEnclosingAreas;
  • Types of object

    Declaration

    Objective-C

    @property (nonatomic) GLMapVectorObjectType objectTypes;
  • Performs search synchronysly

    Declaration

    Objective-C

    - (nonnull GLMapVectorObjectArray *)search;
  • Starts search.

    Declaration

    Objective-C

    - (void)searchAsyncWithCompletionBlock:
        (nonnull GLSearchCompletionBlock)completionBlock;

    Parameters

    completionBlock

    Block 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

    searchResults

    Search results array

    customObjects

    Array of custom objects

    infoBlock

    Block that returns location, category and extra score for custom object

    Return Value

    Returns sorted array

  • Cancels search operation.

    Declaration

    Objective-C

    - (void)cancel;
  • Serialize all settings as json string.

    Declaration

    Objective-C

    - (nonnull NSString *)toJSON;

    Return Value

    Returns json string with search settings.

  • 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

    string

    String 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

    point

    Point

    distance

    Maximum distance from point

    filters

    Search filters applied to results

    Return Value

    Returns vector object or nil if nothing found in distance radius