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
Integrating Sphinx and Elasticsearch
Search
Markus H
February 12, 2015
Programming
0
150
Integrating Sphinx and Elasticsearch
This is a lightning talk presentation I gave a the Python Users Berlin meetup on Feb 12, 2015
Markus H
February 12, 2015
Tweet
Share
More Decks by Markus H
See All by Markus H
🐍 ❤️ 🦀 — Python loves Rust
markush
0
170
Knock! Knock! Who's There?
markush
0
50
An Introduction To Kubernetes ☸
markush
0
72
Writing Safe Database Migrations (DjangoCon Europe 2021)
markush
0
13k
A Pony On The Move: How Migrations Work In Django 🐎
markush
0
12k
All Hands on Deck — Handling Security Issues
markush
0
13k
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon UK 2019)
markush
0
41
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
170
Logging Rethought 2: The Actions of Frank Taylor Jr. (DjangoCon Europe 2019)
markush
0
13k
Other Decks in Programming
See All in Programming
Semantic search with Django and pgvector
pauloxnet
0
240
チーム力を高めるスクラム実践法:カンバン公開と課題攻略について - ニフティのスクラムトーク Vol. 2 - NIFTY Tech Talk #18
niftycorp
PRO
1
110
Milestoner
bkuhlmann
1
400
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.2k
⼤規模⾔語モデルの拡張(RAG)が 終わったかも知れない件について
nearme_tech
22
15k
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
18
4.8k
Netty Chicago Java User Group 2024-04-17
sullis
0
110
Code Reviews
bkuhlmann
4
880
CQRS/ES avec Symfony, c’est (trop) bien !
jeremyfreeagent
1
630
Ruby Pattern Matching
bkuhlmann
0
920
本格ローグライク制作にEbitengineを選んでみた
nagainaganawa
0
290
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
420
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Principles of Awesome APIs and How to Build Them.
keavy
120
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
Bootstrapping a Software Product
garrettdimon
PRO
301
110k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
119
38k
How to train your dragon (web standard)
notwaldorf
72
5.1k
For a Future-Friendly Web
brad_frost
171
8.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
Designing for humans not robots
tammielis
247
25k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
15
1.4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
76
41k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
321
20k
Transcript
Sphinx and Elasticsearch
• elasticsearch-dsl==0.0.3 • Sphinx==1.2.3 Which libraries to use?
def setup(app): app.connect( 'doctree-resolved', index ) Sphinx integration
from elasticsearch_dsl import DocType, String class Document(DocType): title = String(analyzer='snowball',
boost=5) body = String(analyzer='snowball') docname = String(index='not_analyzed') class Meta: index = 'docs' Elasticsearch Document
import hashlib from elasticsearch_dsl.connections import connections connections.create_connection(hosts=['localhost']) def index(app, doctree,
docname): title = app.env.titles[docname].astext() doc = Document( title=title, body=doctree.astext(), docname=docname, ) doc.id = hashlib.md5(docname.encode('utf-8')).hexdigest() doc.save() Index a Document
from elasticsearch_dsl.connections import connections connections.create_connection(hosts=['localhost']) search = Document.search() query =
search.query( 'query_string', query='Migrations', fields=['title', 'body'], ).highlight_options(order='score').highlight('body') results = query.execute() Search
>>> for hit in results: ... print(hit.title) Writing database migrations
Writing your first Django app, part 1 Django documentation FAQ: Databases and models System check framework ... Using the hits
Thank you! markusholtermann.eu @m_holtermann github.com/MarkusH