Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Robust search with Searchkick
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
130
5 basic tips for RubyOnRails projects
nandosousafr
1
460
Workshop Git para o DevInSanta meetup.
nandosousafr
0
78
Other Decks in Technology
See All in Technology
AI駆動開発で仕様はどこまで書くべきか? ― 人とAIの責務境界から考える開発プロセスの実践
takahiromatsui
1
260
20260915deck.gl-raster を使ってみた
rena1208
0
180
Claude Designがめちゃくちゃ便利なので使ってほしい
diggymo
0
170
[Kiro Meetup #7] Kiro Crew Dive Deep
konippi
0
440
AIエージェントを安全で速い現場監督にする:Jev・Obsidian・メタハーネス
x5gtrn
PRO
0
140
キャリアLT今日までそして明日から
kentapapa
1
140
TiDBファミリーにDWHが新登場!! TiDB最新情報 / TiDB update 202609
yoshiakiyamasaki
0
160
Coil3を内部実装から読み解く~キャッシュ戦略とAVIF画像の描画〜/nikkei-tech-talk50
nikkei_engineer_recruiting
0
180
The kernel report
ennael
PRO
1
160
AWS FinOps Agent 結局何が得意なの?
siromi
0
220
AI臭い文章とは何なのか
nasuvitz
36
76k
大阪オフィスに Unitree Go2 がやってきたので Physical AI やってみた
dafujii
0
180
Featured
See All Featured
Designing for Performance
lara
611
70k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
690
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
450
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
250
The Cost Of JavaScript in 2023
addyosmani
55
10k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
Technical Leadership for Architectural Decision Making
baasie
3
580
Statistics for Hackers
jakevdp
799
230k
The Language of Interfaces
destraynor
162
27k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Accessibility Awareness
sabderemane
1
230
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/