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:
Two possible uses for the
fallbackBreakpoint: false: API can’t fallback and will continue to provide a suggestion.
fallbackBreakpoint: 0.3 //float (between 0 and 1): When the suggestion score is lower than the
fallbackBreakpointvalue set, the library will stop calling the corresponding API and switch to the next one (depending on the API order).
A default value is defined for each API:
|Woosmap Search API (stores)||
|Woosmap Localities API||
|Woosmap Address API||
|Google Places API||
Autocomplete service will return an empty result and no fallback will be triggered until the user input length reaches the
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 (
store_name) of a returned
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.