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
78
0
Share
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
270
Yet another introduction to concurrency
nandosousafr
4
220
Tirando Proveito das Rails Engines
nandosousafr
0
100
5 basic tips for RubyOnRails projects
nandosousafr
1
440
Workshop Git para o DevInSanta meetup.
nandosousafr
0
74
Other Decks in Technology
See All in Technology
オライリーイベント登壇資料「鉄リサイクル・産廃業界におけるAI技術実応用のカタチ」
takarasawa_
0
400
続 運用改善、不都合な真実 〜 物理制約のない運用改善はほとんど無価値 / 20260518-ssmjp-kaizen-no-value-without-physical-constraints
opelab
2
170
20260513_生成AIを専属DSに_AI分析結果の検品テクニック_ハンズオン_交通事故データ
doradora09
PRO
0
220
AIを賢くしたいなら、まずは人間の改善ループから
subroh0508
0
110
Agent の「自由」と「安全」〜未来に向けて今できること〜
katayan
0
360
Gaussian Splattingの実用化 - 映像制作への展開
gpuunite_official
0
180
ブラウザの投機的読み込みと投機ルールAPIを理解し、Webサービスのパフォーマンスを最適化する
shuta13
3
310
カオナビに Suspenseを導入するまで / The Road to Suspense at kaonavi
kaonavi
1
450
How to learn AWS Well-Architected with AWS BuilderCards: Security Edition
coosuke
PRO
0
130
AIのための特別なアーキテクチャはいらない 0→1開発で実践した設計原則とガードレール
kaminashi
0
110
AI時代の品質はテストプロセスの作り直し #scrumniigata
kyonmm
PRO
4
1.5k
全社統制を維持しながら現場負担をどう減らすか〜プラットフォームチームとセキュリティチームで進めたSecurity Hub活用によるAWS統制の見直し〜/secjaws-security-hub-custom-insights
mhrtech
1
480
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
Designing Experiences People Love
moore
143
24k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
110
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
500
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
190
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
800
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
190
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/