From 2abfec4f5974e5d3e0d14d9d733b46ebeca81fed Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Thu, 9 Jul 2015 01:46:28 -0700 Subject: [PATCH] Updated misspellings section --- CHANGELOG.md | 4 ++++ README.md | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c29368..084b636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.1 [unreleased] + +- Added `transpositions` option to misspellings + ## 0.9.0 - Much better performance for where queries if no facets diff --git a/README.md b/README.md index 09039d2..451a0fb 100644 --- a/README.md +++ b/README.md @@ -268,24 +268,27 @@ end ### Misspellings -By default, Searchkick handles misspelled queries by returning results with an [edit distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of one. To turn off this feature, use: +By default, Searchkick handles misspelled queries by returning results with an [edit distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of one. + +You can change this with: ```ruby -Product.search "zuchini", misspellings: false # no zucchini +Product.search "zucini", misspellings: {edit_distance: 2} # zucchini ``` -You can also change the edit distance with: +Or turn off misspellings with: ```ruby -Product.search "zucini", misspellings: {edit_distance: 2} # zucchini +Product.search "zuchini", misspellings: false # no zucchini ``` -A transposition of two letters is considered to be an edit distance of 2. Enable single-letter transpositions while leaving edit distance at 1 with: +Swapping two letters counts as two edits. To count the [transposition of two adjacent characters as a single edit](https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance), use: [master] ```ruby -Product.search "zuccihni", misspellings: {transpositions: true} # zucchini +Product.search "mikl", misspellings: {transpositions: true} # milk ``` +This is planned to be the default in Searchkick 1.0. ### Indexing -- libgit2 0.21.0