ISuggestProvider

Interface for a provider of search suggestions.

Constructor | Methods

Constructor

ISuggestProvider()

Methods

Name

Returns

Description

suggest(request[, options])

vow.Promise

Sends a request for search suggestions. Returns a promise object that is either rejected with an error, or confirmed by an array of objects in the format { displayName: "Mitishi, Moscow region", value: "Russia, Moscow region, Mitishi", hl: [[0,5]] }. The displayName field is responsible for representing a toponym in a user-friendly format. The value field is the value that must be inserted in the data entry field after the user selects this suggestion. The hl field is an array of ranges for highlighting to show which part of the result matched the query. The range for highlighting is an array of two numbers: the indexes of the starting and ending symbols of the range.

Methods details

suggest

{vow.Promise} suggest(request[, options])

Sends a request for search suggestions. Returns a promise object that is either rejected with an error, or confirmed by an array of objects in the format { displayName: "Mitishi, Moscow region", value: "Russia, Moscow region, Mitishi", hl: [[0,5]] }. The displayName field is responsible for representing a toponym in a user-friendly format. The value field is the value that must be inserted in the data entry field after the user selects this suggestion. The hl field is an array of ranges for highlighting to show which part of the result matched the query. The range for highlighting is an array of two numbers: the indexes of the starting and ending symbols of the range.

Returns a Promise object.

Parameters:

Parameter

Default value

Description

request*

—

Type: String

Request string.

options

—

Type: Object

Options.

options.boundedBy

—

Type: Number[][]

A rectangular area on the map, where the object being searched for is presumably located. Must be set as an array, such as [[30, 40], [50, 50]].

options.results

—

Type: Number

Maximum number of results to be returned.

* Mandatory parameter/option.