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.2k
Haystack + ElasticSearch
Gilang Chandrasa
June 29, 2013
Tweet
Share
More Decks by Gilang Chandrasa
See All by Gilang Chandrasa
Docker + Django
gchandrasa
2
310
An Introduction to Celery
gchandrasa
8
5k
Other Decks in Programming
See All in Programming
オブジェクト指向のリ・オリエンテーション~歴史を振り返り、AI時代に向きなおる~
hanyudaeiiti
9
5.6k
Elm 0.19.0 Changes
bkuhlmann
0
480
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
110
Elm Form Validation
bkuhlmann
0
500
Rubyでたのしむクリエイティブコーディング/Enjoy Creative coding with Ruby
chobishiba
1
160
StreamlitとTerraformでデータカタログを作った話
gussan0223
0
300
OpenTelemetry のサービスという概念について
azukiazusa1
2
1.1k
What We Can Learn From OSS
inouehi
0
400
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
1.1k
元気予報
suu_mire0726
0
850
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
420
ログラスを支える設計標準について / loglass-design-standards
urmot
10
2.1k
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
186
16k
Producing Creativity
orderedlist
PRO
336
39k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
Done Done
chrislema
178
15k
Building a Scalable Design System with Sketch
lauravandoore
455
32k
The Brand Is Dead. Long Live the Brand.
mthomps
48
28k
Clear Off the Table
cherdarchuk
83
310k
Thoughts on Productivity
jonyablonski
57
3.8k
The Cost Of JavaScript in 2023
addyosmani
14
3.8k
Robots, Beer and Maslow
schacon
PRO
155
7.9k
Designing with Data
zakiwarfel
95
4.8k
The Invisible Customer
myddelton
114
12k
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