# SearchProvider

Finds places by name. Implementations throw `SearchError` for offline,
rate-limited or failed requests and `PortAbortError` when the signal fires.
When a search runs, and cancelling a superseded one, belong to one ui hook.
A service's own usage limits (such as Nominatim's one request per second)
belong to its implementation, since every caller shares them.

This is an interface exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import type { SearchProvider } from "@mapcairn/core";
 
interface SearchProvider
```

## Methods

### reverse

```ts
reverse(position: LatLng, options?: Pick<SearchOptions, "signal">): Promise<SearchResult | null>;
```

Finds the place at a position, or `null` when there is none.

- `position` (`LatLng`)
- `options?` (`Pick<SearchOptions, "signal">`)

### search

```ts
search(query: string, options?: SearchOptions): Promise<readonly SearchResult[]>;
```

Finds places that match the text. A blank query resolves to an empty list.

- `query` (`string`)
- `options?` (`SearchOptions`)

## See also

- [`LatLng`](https://docs.mapcairn.com/api/core/LatLng.md)
- [`SearchOptions`](https://docs.mapcairn.com/api/core/SearchOptions.md)
- [`SearchResult`](https://docs.mapcairn.com/api/core/SearchResult.md)

Source: [packages/core/src/ports/search.ts:39](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/ports/search.ts#L39)
