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
0
76
Robust search with Searchkick
Minitalk about Searchkick gem
Nando Sousa
May 16, 2015
Tweet
Share
More Decks by Nando Sousa
See All by Nando Sousa
Metaprogramming in Elixir
nandosousafr
0
270
Yet another introduction to concurrency
nandosousafr
4
220
Tirando Proveito das Rails Engines
nandosousafr
0
97
5 basic tips for RubyOnRails projects
nandosousafr
1
420
Workshop Git para o DevInSanta meetup.
nandosousafr
0
74
Other Decks in Technology
See All in Technology
Digitization部 紹介資料
sansan33
PRO
1
6.8k
22nd ACRi Webinar - NTT Kawahara-san's slide
nao_sumikawa
0
100
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.8k
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
2
320
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
350
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
170
Webhook best practices for rock solid and resilient deployments
glaforge
2
300
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
200
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
190
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
Why Organizations Fail: ノーベル経済学賞「国家はなぜ衰退するのか」から考えるアジャイル組織論
kawaguti
PRO
1
110
Embedded SREの終わりを設計する 「なんとなく」から計画的な自立支援へ
sansantech
PRO
3
2.5k
Featured
See All Featured
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
Scaling GitHub
holman
464
140k
Building Adaptive Systems
keathley
44
2.9k
Designing Powerful Visuals for Engaging Learning
tmiket
0
240
The Invisible Side of Design
smashingmag
302
51k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
HDC tutorial
michielstock
1
390
Tell your own story through comics
letsgokoyo
1
810
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
93
A better future with KSS
kneath
240
18k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
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/