diff --git a/README.md b/README.md index 672659a..bff7162 100644 --- a/README.md +++ b/README.md @@ -299,7 +299,9 @@ To only match the exact order, use: User.search "fresh honey", match: :phrase ``` -### Language +### Language and Stemming + +Searchkick stems words by default for better matching. `tomatoes` and `tomato` both stem to `tomato`, so searches for either term will have the same matches. Searchkick defaults to English for stemming. To change this, use: @@ -322,6 +324,30 @@ A few languages require plugins: - `ukrainian` - [analysis-ukrainian plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/7.4/analysis-ukrainian.html) - `vietnamese` - [analysis-vietnamese plugin](https://github.com/duydo/elasticsearch-analysis-vietnamese) +Disable stemming with: + +```ruby +class Image < ApplicationRecord + searchkick stem: false +end +``` + +Specify certain words to be excluded from stemming: [unreleased] + +```ruby +class Image < ApplicationRecord + searchkick stem_exclusion: ["tomatoes"] +end +``` + +Or change how words are stemmed: [unreleased] + +```ruby +class Image < ApplicationRecord + searchkick stemmer_override: ["tomatoes => other"] +end +``` + ### Synonyms ```ruby @@ -1858,14 +1884,6 @@ class Product < ApplicationRecord end ``` -Turn off stemming - -```ruby -class Product < ApplicationRecord - searchkick stem: false -end -``` - Turn on stemming for conversions ```ruby -- libgit2 0.21.0