Source: https://developers.woosmap.com/products/multisearch-lib/js/multisearch-reference/

> For clean Markdown of any page, append `.md` to the page URL.

> For a complete documentation index, see https://developers.woosmap.com/llms.txt

# MultiSearch Reference



## multisearch class

`woosmap.multisearch`

Create an instance of the Multisearch library.

### Constructor

#### `multisearch`

`multisearch(defaultSearchOptions)`

**Parameters:**
- `defaultSearchOptions`: `MultiApiOptions` options of the Multisearch library

Create an instance of the Multisearch library.

  

## ApiOptions Interface

### Properties

#### `fallbackBreakpoint?`

**Type** : ` number`

Either `false` to prevent the API from being fallbacked or a number between 0 and 1 corresponding to the threshold of fallback. A value of `0` indicates that the results must contain at least one perfect match while `1` will match anything. If no value is specified, default values are applied for each API (1 for store, 0,4 for localities, 1 for places)

#### `key`

**Type** : ` string`

Authentication key to be able to call the API.

#### `minInputLength?`

**Type** : ` number`

Empty result will be sent by the API and no fallback will be triggered if the input length does not reach the minInputLength value..

#### `params`

**Type** : ` Object`

List of the API params to send. Checkout:

- [Woosmap Localities](https://developers.woosmap.com/products/localities/features/autocomplete/#optional-parameters),
- [Woosmap Store](https://developers.woosmap.com/products/stores-api/concepts/query-syntax/#fields),
- [Google Places](https://developers.google.com/maps/documentation/places/web-service/autocomplete?hl=id#place_autocomplete_requests) (Nb. The Places `language` parameter can be defined only at initialisation of the library)

  

## AutocompleteResponseItem Interface

### Properties

#### `api`

**Type** : ` "localities"`

The api the result was retrieved from

#### `description`

**Type** : ` string`

Contains the human-readable name for the returned result.

#### `highlight`

**Type** : ` string`

HTML description in which the entered term in the prediction result text are in `<mark>`tags

#### `id`

**Type** : ` string`

Item identifier

#### `item`

**Type** : ` object`

The item returned by the API “as is”.

#### `matched_substrings`

**Type** : ` array`

Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired.

#### `types`

**Type** : ` array`

Array of types that apply to this item.

  

## DetailsResponseItem Interface

### Properties

#### `address_components`

**Type** : ` array`

Array containing the separate components applicable to this address. Each component has a long name (full text description or name of the address component), a short name (abbreviated textual name for the address component, if available) and types (array indicating the type of the address component like `locality`, `street_number`…)

#### `formatted_address`

**Type** : ` string`

String containing the human-readable address of this item.

#### `geometry`

**Type** : ` object`

Item geometry (`{location:{lat, lng}}`)

#### `id`

**Type** : ` string`

Item identifier

#### `item`

**Type** : ` object`

Item returned by the API “as is”.

#### `name`

**Type** : ` string`

Item name

#### `types`

**Type** : ` array`

Types of the given item (like `locality` or `postal_code`)

  

## MultiApiOptions Interface

### Properties

#### `debounceTime?`

**Type** : ` number`

The amount of time in ms the autocomplete function will wait after the last received call before executing the next one.

#### `localities?`

**Type** : ` ApiOptions`

Options for the Woosmap Localities API.

#### `places?`

**Type** : ` ApiOptions`

Options for the Google Places API.

#### `store?`

**Type** : ` ApiOptions`

Options for the Woosmap Stores API.

  

## autocompleteLocalities Interface

Type: `Function`

Query the autocomplete Woosmap Localities API. Check out the API [documentation](https://developers.woosmap.com/products/localities/search-city-postcode/)

### Function

#### `autocompleteLocalities`

`autocompleteLocalities(input, options?, callback?)`

**Parameters:**
- `input`: `string` the input to autocomplete on
- `options`: `ApiOptions` Options of the API
- `callback`: `Function` `function(error, results)` for response callback

Query the autocomplete Woosmap Localities API. Check out the API [documentation](https://developers.woosmap.com/products/localities/search-city-postcode/)

  

## autocompleteMulti Interface

Type: `Function`

Query the different autocomplete APIs defined in the `apiOrder` list. Depending on the `fallbackBreakpoint` and the `minInputLength` defined for each API, if the first API does not send revelant enough results, it will query the next one, until results are relevant or no other API is in the list.

### Function

#### `autocompleteMulti`

`autocompleteMulti(input, options?, callback?)`

**Parameters:**
- `input`: `string` the input to autocomplete on
- `options`: `MultiApiOptions` Options of the API
- `callback`: `Function` `function(error, results)` for response callback

Query the different autocomplete APIs defined in the `apiOrder` list. Depending on the `fallbackBreakpoint` and the `minInputLength` defined for each API, if the first API does not send revelant enough results, it will query the next one, until results are relevant or no other API is in the list.

  

## autocompleteStore Interface

Type: `Function`

Query the autocomplete Woosmap Stores API.

### Function

#### `autocompleteStore`

`autocompleteStore(input, options?, callback?)`

**Parameters:**
- `input`: `string` the input to autocomplete on
- `options`: `ApiOptions` Options of the API
- `callback`: `Function` `function(error, results)` for response callback

Query the autocomplete Woosmap Stores API.

  

## detailsPlaces Interface

Type: `Function`

Query the details Google Places API to get details of a place. Check out the API [documentation](https://developers.google.com/maps/documentation/places/web-service/details)

### Function

#### `detailsPlaces`

`detailsPlaces(id, callback?)`

**Parameters:**
- `id`: `string` the place id to retrieve details from
- `callback`: `Function` `function(error, results)` for response callback

Query the details Google Places API to get details of a place. Check out the API [documentation](https://developers.google.com/maps/documentation/places/web-service/details)

  

## detailsMulti Interface

Type: `Function`

Query the details api to get details of an item.

### Function

#### `detailsMulti`

`detailsMulti(id, api, callback?)`

**Parameters:**
- `id`: `string` the id of the item to retrieve details from
- `api`: `"localities"` the api to retrieve details from
- `callback`: `Function` `function(error, results)` for response callback

Query the details api to get details of an item.

  

## autocompletePlaces Interface

Type: `Function`

Query the autocomplete Google Places API. Check out the API [documentation](https://developers.google.com/maps/documentation/places/web-service/autocomplete)

### Function

#### `autocompletePlaces`

`autocompletePlaces(input, options?, callback?)`

**Parameters:**
- `input`: `string` the input to autocomplete on
- `options`: `ApiOptions` Options of the API
- `callback`: `Function` `function(error, results)` for response callback

Query the autocomplete Google Places API. Check out the API [documentation](https://developers.google.com/maps/documentation/places/web-service/autocomplete)
