Fallback Autocomplete Services

Fallback concept explaining when and how to switch between autocomplete providers to get the best user experience.

  1. Fallback configuration
  2. How is the score calculated?

Fallback configuration

This library implements a fallback system enabling to switch from one API to another. This system is flexible and can be manually adjusted for each API in order to be efficient for each of your specific use cases.

Two parameters have an impact on the fallback:

fallbackBreakpoint

Two possible uses for the fallbackBreakpoint parameter:

A default value is defined for each API:

API parameter/provider name default fallbackBreakpoint
Woosmap Search API (stores) STORE 1
Woosmap Localities API LOCALITIES 0.4
Google Places API PLACES 1

minInputLength

Autocomplete service will return an empty result and no fallback will be triggered until the user input length reaches the minInputLength value.

How is the score calculated?

The score could be considered as a Levenshtein Distance between those two strings: the input from the user and the value (formatted_address or store_name) of a returned autocomplete item. We use the fuzzy searching JavaScript library Fuse.js in all our MultiSearch SDKs (Javascript, iOS and Android).

Generally speaking, fuzzy searching (formerly known as approximate string matching) is the technique of finding strings that are approximately equal to a given pattern (rather than exactly).

Have a look at the Fuse.js scoring explanation for more details.

Was this article helpful?
Have more questions? Submit a request