Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
180
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
250
Knock! Knock! Who's There?
markush
0
68
An Introduction To Kubernetes ☸
markush
0
110
Writing Safe Database Migrations (DjangoCon Europe 2021)
markush
0
14k
A Pony On The Move: How Migrations Work In Django 🐎
markush
0
13k
All Hands on Deck — Handling Security Issues
markush
0
14k
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon UK 2019)
markush
0
64
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
210
Logging Rethought 2: The Actions of Frank Taylor Jr. (DjangoCon Europe 2019)
markush
0
13k
Other Decks in Programming
See All in Programming
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
320
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
6
1.3k
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
110
20 years of Symfony, what's next?
fabpot
2
360
AIコーディングエージェント(skywork)
kondai24
0
170
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
390
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
170
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
380
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
3
720
チームをチームにするEM
hitode909
0
330
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
410
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
130
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
What's in a price? How to price your products and services
michaelherold
246
13k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
We Have a Design System, Now What?
morganepeng
54
7.9k
Building Applications with DynamoDB
mza
96
6.8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
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