Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Robust search with Searchkick
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Nando Sousa
May 16, 2015
Technology
85
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Robust search with Searchkick
Minitalk about Searchkick gem
Nando Sousa
May 16, 2015
More Decks by Nando Sousa
See All by Nando Sousa
Metaprogramming in Elixir
nandosousafr
0
280
Yet another introduction to concurrency
nandosousafr
4
230
Tirando Proveito das Rails Engines
nandosousafr
0
120
5 basic tips for RubyOnRails projects
nandosousafr
1
460
Workshop Git para o DevInSanta meetup.
nandosousafr
0
77
Other Decks in Technology
See All in Technology
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
250
Benchmarking Vector Databases: pgvector vs. LanceDB
tsho
0
150
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
220
AI時代のAPI品質を支えるガードレール / API Guardrails for API quality in the AI era
yokawasa
1
170
GoにおけるFFIのこれまでとこれから
goccy
4
1.2k
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
110
2026/09/10 Spring_Bootから_Jakarta_EE_MicroProfileへの移行
megascus
0
240
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
250
作り直せるコードは迅速に 作り直せないDBは慎重に - AI時代のプロダクトエンジニアが「判断の不可逆性」で開発速度を変える話
kinosuke01
0
280
「図書館」という名前のままでいいのか -Code4Lib JAPANカンファレンス2026 アンカンファレンス報告- / Code4Lib JAPAN Conference 2026: Unconference Report
ykiyota
0
110
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
290
Bet AI Day 2026丨AIによって本質に戻るシステムリスク管理
layerx
PRO
0
1.3k
Featured
See All Featured
Designing for Timeless Needs
cassininazir
1
470
エンジニアに許された特別な時間の終わり
watany
108
250k
Test your architecture with Archunit
thirion
2
2.4k
Amusing Abliteration
ianozsvald
1
290
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
GitHub's CSS Performance
jonrohan
1033
470k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
570
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Transcript
searchkick
• Full Stack Developer at Resultados Digitais • @nandosousafr on
twitter • Marketing B.I team • shipit.resultadosdigitais.com.br
Problem Itunes search sucks!
scheme name string description text podcasts title string show_notes text
podcast_id integer episodes
$ brew install elasticsearch Searchkick requires elasticsearch
Gemfile gem 'searchkick' $ bundle install
app/models/episode.rb class Episode < ActiveRecord::Base belongs_to :podcast end searchkick Automatically
adds callbacks after_commit :reindex
$ bundle exec rake searchkick:reindex:all Indexing $ bundle exec rake
searchkick:reindex CLASS=Episode Episode.reindex
class SearchController < ApplicationController def index end end @episodes =
Episode.search term, includes: :podcast term = params[:q].presence || '*' eager loading app/controllers/search_controller.rb
Problem solved!
Highlights
class Episode < ActiveRecord::Base searchkick end app/models/episode.rb highlight: [:show_notes] $
bundle exec rake searchkick:reindex CLASS=Episode reindex
app/controllers/search_controller.rb class SearchController < ApplicationController def index term = params[:q].presence
|| '*' @episodes = Episode.search term, search_options end protected def search_options end end { includes: :podcast, highlight: { tag: '<strong>', fields: { show_notes: { fragment_size: 300 } } } }
So much better!
title must be stronger than show notes
Boosting fields
def search_options { includes: :podcast, highlight: { tag: '<strong>', fields:
{ show_notes: { fragment_size: 300 } } }, } end Boost and sort fields: ['title^10', 'show_notes^5'], order: { _score: :desc, release_date: :desc }
None
Facets
None
None
Quick tips
Asynchronous reindex class Episode < ActiveRecord::Base # ActiveJob required searchkick
callbacks: :async # Disable callbacks searchkick callbacks: false end
Personalized Results class Episode < ActiveRecord::Base has_many :users def search_data
attributes.merge( favorited_by: users.pluck(:id) ) end end # SearchController Episode.search 'Rails', boost_where: { favorited_by: current_user.id }
OpenSource http://podaholic.com
[email protected]
@nandosousafr We’re hiring! resultadosdigitais.com.br/trabalhe-conosco/