TomTom Maps for JavaScript
    Preparing search index...

    Type Alias FuzzySearchParams

    FuzzySearchParams: CommonSearchParams<URL, FuzzySearchResponseAPI> & CommonGeocodeAndFuzzySearchParams & {
        maxFuzzyLevel?: number;
        minFuzzyLevel?: number;
        position?: HasLngLat;
    }

    Parameters for fuzzy search queries.

    Fuzzy search finds places and addresses using partial or misspelled text queries. It's designed to handle typos, abbreviations, and incomplete input gracefully.

    Type Declaration

    • OptionalmaxFuzzyLevel?: number

      Maximum fuzziness level to be used.

      Controls the upper limit of tolerance for character differences. Higher values allow more variations but may include irrelevant results.

      The search will try increasingly fuzzy matching up to this level if no results are found at lower levels.

      2
      

      1

      4

      // Allow very fuzzy matching
      maxFuzzyLevel: 4

      // Strict matching only
      maxFuzzyLevel: 1
    • OptionalminFuzzyLevel?: number
    • Optionalposition?: HasLngLat

      Geographic position to bias search results toward.

      When provided, results closer to this position are ranked higher. Does not filter results, only creates a soft bias.

      Accepts any HasLngLat-compatible value:

      • [longitude, latitude] coordinate pair
      • GeoJSON Point geometry
      • GeoJSON Feature<Point> — pass a Place directly
      // Coordinate pair
      position: [4.9041, 52.3676]

      // Place result from a previous search
      position: searchResults.features[0]

      // GeoJSON Point
      position: { type: 'Point', coordinates: [4.9041, 52.3676] }

    Key Features:

    • Tolerates typos and spelling mistakes
    • Handles partial queries and abbreviations
    • Searches both addresses and POIs
    • Configurable fuzziness levels for precision control
    • Ranked results by relevance

    Use Cases:

    • Search box implementations
    • User-entered free-form text searches
    • Recovery from autocomplete failures
    • Broad exploratory searches
    // Basic fuzzy search
    const params: FuzzySearchParams = {
    key: 'your-api-key',
    query: 'pizz', // Will find "pizza" restaurants
    position: [4.9041, 52.3676]
    };

    // Fuzzy search with custom fuzziness
    const customParams: FuzzySearchParams = {
    key: 'your-api-key',
    query: 'restaurnt', // Misspelled "restaurant"
    minFuzzyLevel: 1,
    maxFuzzyLevel: 3,
    limit: 10
    };