Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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.4k
Haystack + ElasticSearch
Gilang Chandrasa
June 29, 2013
Tweet
Share
More Decks by Gilang Chandrasa
See All by Gilang Chandrasa
Docker + Django
gchandrasa
2
330
An Introduction to Celery
gchandrasa
8
5.1k
Other Decks in Programming
See All in Programming
マスタデータ問題、マイクロサービスでどう解くか
kts
0
100
これならできる!個人開発のすゝめ
tinykitten
PRO
0
110
WebRTC と Rust と8K 60fps
tnoho
2
2k
Github Copilotのチャット履歴ビューワーを作りました~WPF、dotnet10もあるよ~ #clrh111
katsuyuzu
0
110
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
470
開発に寄りそう自動テストの実現
goyoki
2
980
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
310
Go コードベースの構成と AI コンテキスト定義
andpad
0
130
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.4k
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
sbt 2
xuwei_k
0
300
Microservices rules: What good looks like
cer
PRO
0
1.4k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
76
5.2k
A Tale of Four Properties
chriscoyier
162
23k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
The Pragmatic Product Professional
lauravandoore
37
7.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Building Applications with DynamoDB
mza
96
6.8k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
For a Future-Friendly Web
brad_frost
180
10k
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