Commit e9b531ae66d2d03aee5555e5d112d4fc21cff9fb
1 parent
dabbbea7
Exists in
master
and in
21 other branches
Updated readme
Showing
1 changed file
with
11 additions
and
3 deletions
Show diff stats
README.md
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | Search made easy |
4 | 4 | |
5 | -## Usage | |
6 | - | |
7 | 5 | Searchkick provides sensible search defaults out of the box. It handles: |
8 | 6 | |
9 | 7 | - stemming - `tomatoes` matches `tomato` |
... | ... | @@ -12,6 +10,8 @@ Searchkick provides sensible search defaults out of the box. It handles: |
12 | 10 | - misspellings - `zuchini` matches `zucchini` |
13 | 11 | - custom synonyms - `qtip` matches `cotton swab` |
14 | 12 | |
13 | +## Usage | |
14 | + | |
15 | 15 | ```ruby |
16 | 16 | class Book < ActiveRecord::Base |
17 | 17 | searchkick :name |
... | ... | @@ -24,7 +24,15 @@ And to query, use: |
24 | 24 | Book.search("Nobody Listens to Andrew") |
25 | 25 | ``` |
26 | 26 | |
27 | -**Note:** We recommend reindexing when changing synonyms for best results. | |
27 | +### Synonyms | |
28 | + | |
29 | +```ruby | |
30 | +class Book < ActiveRecord::Base | |
31 | + searchkick :name, synonyms: ["scallion => green onion"] # TODO Ruby syntax | |
32 | +end | |
33 | +``` | |
34 | + | |
35 | +You must call `Book.reindex` after changing synonyms. | |
28 | 36 | |
29 | 37 | ### Make Searches Better Over Time |
30 | 38 | ... | ... |