Fuzziness parameter
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.
_
FuzzySearchEngineDescriptor fuzzySearchEngineDescriptor = new FuzzySearchEngineDescriptor.Builder()
.minFuzzyLevel(1)
.maxFuzzyLevel(maxLevel)
.build();
FuzzyLocationDescriptor fuzzyLocationDescriptor = new FuzzyLocationDescriptor.Builder()
.positionBias(new LatLngBias(position))
.build();
return new FuzzySearchSpecification.Builder(term)
.searchEngineDescriptor(fuzzySearchEngineDescriptor)
.locationDescriptor(fuzzyLocationDescriptor)
.build();
val searchEngineDescriptor = FuzzySearchEngineDescriptor.Builder()
.minFuzzyLevel(1)
.maxFuzzyLevel(maxFuzzyLevel)
.build()
val fuzzySearchSpecification = FuzzySearchSpecification.Builder(term)
.searchEngineDescriptor(searchEngineDescriptor)
.locationDescriptor(locationDescriptorBuilder.build())
.build()