Commit 2abfec4f5974e5d3e0d14d9d733b46ebeca81fed
1 parent
f151d404
Exists in
master
and in
21 other branches
Updated misspellings section
Showing
2 changed files
with
13 additions
and
6 deletions
Show diff stats
CHANGELOG.md
README.md
@@ -268,24 +268,27 @@ end | @@ -268,24 +268,27 @@ end | ||
268 | 268 | ||
269 | ### Misspellings | 269 | ### Misspellings |
270 | 270 | ||
271 | -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: | 271 | +By default, Searchkick handles misspelled queries by returning results with an [edit distance](http://en.wikipedia.org/wiki/Levenshtein_distance) of one. |
272 | + | ||
273 | +You can change this with: | ||
272 | 274 | ||
273 | ```ruby | 275 | ```ruby |
274 | -Product.search "zuchini", misspellings: false # no zucchini | 276 | +Product.search "zucini", misspellings: {edit_distance: 2} # zucchini |
275 | ``` | 277 | ``` |
276 | 278 | ||
277 | -You can also change the edit distance with: | 279 | +Or turn off misspellings with: |
278 | 280 | ||
279 | ```ruby | 281 | ```ruby |
280 | -Product.search "zucini", misspellings: {edit_distance: 2} # zucchini | 282 | +Product.search "zuchini", misspellings: false # no zucchini |
281 | ``` | 283 | ``` |
282 | 284 | ||
283 | -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: | 285 | +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] |
284 | 286 | ||
285 | ```ruby | 287 | ```ruby |
286 | -Product.search "zuccihni", misspellings: {transpositions: true} # zucchini | 288 | +Product.search "mikl", misspellings: {transpositions: true} # milk |
287 | ``` | 289 | ``` |
288 | 290 | ||
291 | +This is planned to be the default in Searchkick 1.0. | ||
289 | 292 | ||
290 | ### Indexing | 293 | ### Indexing |
291 | 294 |