Commit b5f09f1c9416da989987a69250dd72a190343eb9
1 parent
c69cc0aa
Exists in
master
and in
21 other branches
Added emoji search
Showing
5 changed files
with
34 additions
and
0 deletions
Show diff stats
CHANGELOG.md
Gemfile
README.md
... | ... | @@ -315,6 +315,22 @@ Or turn off misspellings with: |
315 | 315 | Product.search "zuchini", misspellings: false # no zucchini |
316 | 316 | ``` |
317 | 317 | |
318 | +### Emoji [master] | |
319 | + | |
320 | +Make :ice_cream::cake: match `ice cream cake`! | |
321 | + | |
322 | +Add this line to your application’s Gemfile: | |
323 | + | |
324 | +```ruby | |
325 | +gem 'gemoji-parser' | |
326 | +``` | |
327 | + | |
328 | +And use: | |
329 | + | |
330 | +```ruby | |
331 | +Product.search "[emoji go here]", emoji: true | |
332 | +``` | |
333 | + | |
318 | 334 | ### Indexing |
319 | 335 | |
320 | 336 | Control what data is indexed with the `search_data` method. Call `Product.reindex` after changing this method. | ... | ... |
lib/searchkick/query.rb
test/match_test.rb
... | ... | @@ -197,4 +197,16 @@ class MatchTest < Minitest::Test |
197 | 197 | ] |
198 | 198 | assert_search "almond", [] |
199 | 199 | end |
200 | + | |
201 | + def test_emoji | |
202 | + skip unless defined?(EmojiParser) | |
203 | + store_names ["Banana"] | |
204 | + assert_search "🍌", ["Banana"], emoji: true | |
205 | + end | |
206 | + | |
207 | + def test_emoji_multiple | |
208 | + skip unless defined?(EmojiParser) | |
209 | + store_names ["Ice Cream Cake"] | |
210 | + assert_search "🍨🍰", ["Ice Cream Cake"], emoji: true | |
211 | + end | |
200 | 212 | end | ... | ... |