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
Haystack + ElasticSearch
Search
Gilang Chandrasa
June 29, 2013
Programming
2
2.3k
Haystack + ElasticSearch
Gilang Chandrasa
June 29, 2013
Tweet
Share
More Decks by Gilang Chandrasa
See All by Gilang Chandrasa
Docker + Django
gchandrasa
2
320
An Introduction to Celery
gchandrasa
8
5.1k
Other Decks in Programming
See All in Programming
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
Amazon Qを使ってIaCを触ろう!
maruto
0
400
役立つログに取り組もう
irof
28
9.6k
CSC509 Lecture 11
javiergs
PRO
0
180
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Remix on Hono on Cloudflare Workers
yusukebe
1
290
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
イベント駆動で成長して委員会
happymana
1
320
Jakarta EE meets AI
ivargrimstad
0
610
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Scaling GitHub
holman
458
140k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
A designer walks into a library…
pauljervisheath
204
24k
How GitHub (no longer) Works
holman
310
140k
How STYLIGHT went responsive
nonsquared
95
5.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Designing for humans not robots
tammielis
250
25k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
Haystack + ElasticSearch Gilang Chandrasa
Django Python PHP ElasticSearch HTML5 Memcache MongoDB Celery NginX Android
Git MySQL PostgreSQL Gilang Chandrasa CSS3
Haystack Why What How
A modular search for Django
lets you write your search code once and choose the
search engine you want it to run on
lets you write your search code once and choose the
search engine you want it to run on Solr, Elasticsearch, Whoosh and Xapian
pip install django-haystack Step 1 Install Haystack
INSTALLED_APPS = [ ... 'haystack', ] HAYSTACK_CONNECTIONS = { 'default':
{ 'ENGINE': '...', }, } Step 2 Configure settings.py
class NoteIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) author = indexes.CharField(model_attr='user')
def get_model(self): return Note Step 3 Create search_index.py
{{ object.title }} {{ object.user.get_full_name }} {{ object.body }} Step
4 Create search template
Step 5 Install Search Engine Solr Xapian Whoosh ElasticSearch
Step 6 Indexing python manage.py rebuild_index
Some Advanced Uses Highlighting Autocomplete Boost Rich Content Extraction Spatial
Search
ElasticSearch
ElasticSearch distributed real-time search and analytics engine for the cloud
real time data real time analytics distributed high availability multi
tenancy full text search document oriented conflict management schema free restful API apache 2 open source license per operation persistence built on top apache lucene
Spatial Search within, dwithin, distance, order_by(‘distance’), polygon
location = Point(float(longitude), float(latitude)) SearchQuerySet()\ .dwithin('location', location,D(km=10))\ .distance('location',location)\ .order_by('distance') Search
places within 10km and order by distance
haystacksearch.org elasticsearch.org Further Reading
thank you!
Gilang Chandrasa twitter.com + github.com @gchandrasa