This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias FuzzySearchParams

    FuzzySearchParams: CommonSearchParams<GetObject, FuzzySearchResponseAPI> & CommonGeocodeAndFuzzySearchParams & {
        filters?: SearchFilters;
        maxFuzzyLevel?: FuzzyLevel;
        minFuzzyLevel?: FuzzyLevel;
    }

    Parameters for fuzzy search queries.

    Fuzzy search finds places and addresses from partial or misspelled text queries. It handles typos, abbreviations and incomplete input gracefully.

    Type Declaration

    • Optionalfilters?: SearchFilters

      The country and POI-attribute restrictions, together, on what may come back.

    • OptionalmaxFuzzyLevel?: FuzzyLevel

      Maximum fuzziness level to use.

      It sets the last spell-checking level the search tries, of those minFuzzyLevel lists. Higher values allow more variations but may include irrelevant results.

      If no results are found at lower levels, the search tries increasingly fuzzy matching up to this level.

      2
      
      // Allow very fuzzy matching
      maxFuzzyLevel: 4

      // Strict matching only
      maxFuzzyLevel: 1
    • OptionalminFuzzyLevel?: FuzzyLevel

      Minimum fuzziness level to use.

      The search starts matching at this level. Lower values require closer matches to the query text.

      Each level adds spell checking to the one below it, as FuzzyLevel lists.

      Higher minimum levels make the search more lenient but may return less relevant results. The minimum can't exceed maxFuzzyLevel, which defaults to 2.

      1
      
      minFuzzyLevel: 2  // Start one level more lenient than the default
      

    Pass these to discoverPlaces.

    Its fuzziness levels control how loosely it matches, and it ranks results by relevance.

    // Basic fuzzy search
    const params: FuzzySearchParams = {
    query: 'pizz', // Will find "pizza" restaurants
    geoBias: { position: [4.9041, 52.3676] }
    };

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