Commit 5ca842cbd44120c051d95df486b2f9f40e047577
1 parent
6aee0b49
Exists in
master
Added different matching for different fields to readme - #1574 [skip ci]
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
README.md
... | ... | @@ -292,12 +292,18 @@ Option | Matches | Example |
292 | 292 | |
293 | 293 | The default is `:word`. The most matches will happen with `:word_middle`. |
294 | 294 | |
295 | +To specify different matching for different fields, use: | |
296 | + | |
297 | +```ruby | |
298 | +Product.search(query, fields: [{name: :word_start}, {brand: :word_middle}]) | |
299 | +``` | |
300 | + | |
295 | 301 | ### Exact Matches |
296 | 302 | |
297 | 303 | To match a field exactly (case-sensitive), use: |
298 | 304 | |
299 | 305 | ```ruby |
300 | -Product.search(query, fields: [{email: :exact}, :name]) | |
306 | +Product.search(query, fields: [{name: :exact}]) | |
301 | 307 | ``` |
302 | 308 | |
303 | 309 | ### Phrase Matches | ... | ... |