Class: Autocomplete

cercalia.service.Autocomplete

This class lets you convert a <input type="text"> HTML element, into a suggest address search.

new cercalia.service.Autocomplete(options)

Name Type Description
options cercaliax.service.AutocompleteOptions

Methods

Close autocomplete div.

Returns:
ClassName. Value cercalia.service.Autocomplete

getGeocoding(){Object}

Returns:
Return a JSON object with the last information.

setCallbackfunction(callbackfunction)

Assign a callback function after selecting a candidate from the suggest list

Name Type Description
callbackfunction function

setSearchFilterEntity()

Set filter by municipality / region / subregion (by entity code). You can mix that entities. Parameter examples:
ESP170792,ESPCAT,ES08 or * [ESP170792, ESPCAT, ES08]
ESP,ESP08,ESP17,PRT,AND.

setSearchFilterType(type)

Search within type specified. Possible values are: st (streets), ct (locality), p (pois), all|null. It is possible specify more than one value. Example : st,ct

Name Type Description
type string | Array.<string> | null

setSearchInsideCountry(countriesId)

Search inside a country. For example: 'ESP,FRA,GBR' or ['ESP','FRA','GBR']

Name Type Description
countriesId string | Array.<string> | null

setSearchInsideLocality(localityId)

Search inside a locality. For example: ESP17240205544993 (Vallecas), ESP17240205545872 (La Barceloneta), etc..

Name Type Description
localityId string | Array.<string> | null

setSearchInsideMunicipality(municipalityId)

Search inside a municipality. For example: ESP280796 (Madrid), ESP080193 (Barcelona), etc..

Name Type Description
municipalityId string | Array.<string> | null

setSearchInsideProvince(provinceId)

Search inside a region. For example: ESP17 (Girona), ESP08 (Barcelona) etc..

Name Type Description
provinceId string | Array.<string> | null

setSearchInsideRegion(regionsId)

Search inside a region. For example: ESPMAD (Comunidad de Madrid), ESPCAT (Catalunya), etc..

Name Type Description
regionsId string | Array.<string> | null

setSearchPreferredEntity(entities)

Set preferred municipality / region / subregion / country (by entity code). Not compatible with "searchPriorityEntity". This filter, use a soft prioritizaton of the results that are in the specified regions above the other candidates, but does not eliminate the results from other regions or countries. This filter can be combined with the rsc filter for maximum results filter beyond the preferred. Example: ESPVAL. In case you need to prioritize candidates in the list of preferred regions, the regions may be separated by parameters according to priority level: first element: maximum priority, second element: second level priority, etc. ['ESP170792', 'AND', 'ESP,FRA'].
['ESPCAT', 'ESPMAD', 'PRT,AND,FRA'].

Name Type Description
entities string | Array.<string> | null

Entities.

setSearchPriorityEntity(entities)

Set preferred municipality / region / subregion (by entity code). This filter, prioritizes the results that are in the specified regions above the other candidates, but does not eliminate the results from other regions or countries. This filter can be combined with the rsc filter for maximum results filter beyond the preferred. Example: ESPVAL. In case you need to prioritize candidates in the list of preferred regions, the regions may be separated by parameters according to priority level: first element: maximum priority, second element: second level priority, etc
Parameter examples:
['ESP170792', 'AND', 'ESP,FRA'].
['ESPCAT', 'ESPMAD', 'PRT,AND,FRA'].

Name Type Description
entities string | Array.<string> | null

Entities.