Commit 4fcadf8b53246edf7dba5b0899fae4e23754f5f0
1 parent
dfdffe97
Exists in
master
and in
19 other branches
Added practical example of exclude [skip ci]
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -383,6 +383,17 @@ If a user searches `butter`, they may also get results for `peanut butter`. To p |
383 | 383 | Product.search "butter", exclude: ["peanut butter"] |
384 | 384 | ``` |
385 | 385 | |
386 | +You can map queries and terms to exclude with: | |
387 | + | |
388 | +```ruby | |
389 | +exclude_queries = { | |
390 | + "butter" => ["peanut butter"], | |
391 | + "cream" => ["ice cream"] | |
392 | +} | |
393 | + | |
394 | +Product.search query, exclude: exclude_queries[query] | |
395 | +``` | |
396 | + | |
386 | 397 | ### Emoji |
387 | 398 | |
388 | 399 | Search :ice_cream::cake: and get `ice cream cake`! | ... | ... |