Fuzziness parameter

Help your users even more with Fuzzy Search. Use the right fuzziness levels in your app to make it less sensitive to typos.

Sample use case: You occasionally make mistakes when typing. Your app still returns the desired search results. Use the following code snippet to try this in your app.

  • Level 1: Uses no spell checking.
  • Level 2: Uses normal n-gram spell checking. For example, a query "restrant" can be matched to " restaurant".
  • Level 3: Uses sound-like spell checking and shingle spell checking. Sound-like spell checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" to "mountain view" matching.
  • Level 4: Doesn’t add any more spell checking functionality.

The search engine will start looking for a match on the level defined by minFuzzyLevel and will stop searching at the level specified by maxFuzzyLevel.

1FuzzySearchEngineDescriptor fuzzySearchEngineDescriptor = new FuzzySearchEngineDescriptor.Builder()
2 .minFuzzyLevel(1)
3 .maxFuzzyLevel(maxLevel)
4 .build()
6FuzzyLocationDescriptor fuzzyLocationDescriptor = new FuzzyLocationDescriptor.Builder()
7 .positionBias(new LatLngBias(position))
8 .build();
10return new FuzzySearchSpecification.Builder(term)
11 .searchEngineDescriptor(fuzzySearchEngineDescriptor)
12 .locationDescriptor(fuzzyLocationDescriptor)
13 .build();
1val searchEngineDescriptor = FuzzySearchEngineDescriptor.Builder()
2 .minFuzzyLevel(1)
3 .maxFuzzyLevel(maxFuzzyLevel)
4 .build()
6val fuzzySearchSpecification = FuzzySearchSpecification.Builder(term)
7 .searchEngineDescriptor(searchEngineDescriptor)
8 .locationDescriptor(locationDescriptorBuilder.build())
9 .build()