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
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
セキュリティについて学ぶ会 / 2026 01 25 Takamatsu WordPress Meetup
rocketmartue
1
310
SREチームをどう作り、どう育てるか ― Findy横断SREのマネジメント
rvirus0817
0
320
こんなところでも(地味に)活躍するImage Modeさんを知ってるかい?- Image Mode for OpenShift -
tsukaman
1
160
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
1
2.9k
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
620
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
240
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
680
OWASP Top 10:2025 リリースと 少しの日本語化にまつわる裏話
okdt
PRO
3
820
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
17k
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
980
20260204_Midosuji_Tech
takuyay0ne
1
160
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Writing Fast Ruby
sferik
630
62k
Test your architecture with Archunit
thirion
1
2.2k
My Coaching Mixtape
mlcsv
0
48
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
37k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
78
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
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/