Skip to main content

useSearch

Cancellable place search over the services' SearchProvider, run only when the user submits. Text that is a coordinate pair, such as -26.2041, 28.0473 or 26°12'14.8"S 28°02'50.3"E, is answered here with one result for that place and never reaches the provider, so it sends no request. Nothing is sent to the geocoder while they type, as the OpenStreetMap Foundation's Nominatim policy forbids client-side autocomplete; suggestions as they type come from a separate provider (see useSuggestions). This is the one place that owns the AbortController: each search aborts the one before it, and an aborted request never changes state or reaches the announcer. The provider itself keeps to the service's rate limit.

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { useSearch } from "@mapcairn/map";

function useSearch(input?: UseSearchOptions): UseSearch;

Description​

Announcements go through the app-wide announcer: the result count (or "No results", or the error) once the search settles. An identical message is not repeated for consecutive searches until the box has been emptied or Retry is pressed.

Parameters​

  • { getBias, onPick, }?
  • input? (UseSearchOptions)

Returns​

UseSearch

See also​

Source: packages/map/src/tools/SearchPill/useSearch.ts:111