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
PyBR12
Search
Patty Vader
October 12, 2016
Programming
0
61
PyBR12
Patty Vader
October 12, 2016
Tweet
Share
More Decks by Patty Vader
See All by Patty Vader
Python para Machine Learning
pattyvader
0
30
Search Engines using Python and Elasticsearch
pattyvader
0
180
Pygame
pattyvader
0
78
GitHubWTM
pattyvader
0
47
Other Decks in Programming
See All in Programming
CSC509 Lecture 02
javiergs
PRO
0
370
OWASP Kansai DAY 2025.09: OSINTにふれてみよう
deka_morita
0
150
2025年版 サーバーレス Web アプリケーションの作り方
hayatow
23
24k
猫と暮らすネットワークカメラ生活🐈 ~Vision frameworkでペットを愛でよう~ / iOSDC Japan 2025
yutailang0119
0
200
LLMとPlaywright/reg-suitを活用した jQueryリファクタリングの実際
kinocoboy2
4
590
CI_CD「健康診断」のススメ。現場でのボトルネック特定から、健康診断を通じた組織的な改善手法
teamlab
PRO
0
120
Web Components で実現する Hotwire とフロントエンドフレームワークの橋渡し / Bridging with Web Components
da1chi
2
840
Чего вы не знали о строках в Python – Василий Рябов, PythoNN
sobolevn
0
150
defer f()とdefer fの挙動を 誤解していた話
kogamochiduki
1
120
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
320
議事録の要点整理を自動化! サーバレス Bot 構築術
penpeen
3
1.5k
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
160
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
339
57k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.2k
The World Runs on Bad Software
bkeepers
PRO
71
11k
A Tale of Four Properties
chriscoyier
160
23k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Building an army of robots
kneath
306
46k
Code Review Best Practice
trishagee
72
19k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
940
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Transcript
Search Engines utilizando Python e Elasticsearch
Apresentação https://spekerdeck.com/pattyvader/pybr12
Projeto Athena https://github.com/pattyvader/athena
Roadmap 1. Busca de documentos 2. Indexação 3. Percorrendo a
web
Busca de documentos
Busca de documentos Resultado armazenado no Elasticsearch Termo de busca
Busca de documentos Servidor de aplicação com Django GET Browser
(HTML)
Servidor de aplicação com Django Busca de documentos GET Browser
(HTML)
Busca de documentos . Servidor de aplicação com Django
Busca de documentos views.py Acessar o método “search” Servidor de
aplicação com Django
Busca de documentos views.py Acessar o método “search” Acessar o
método “search_term” Servidor de aplicação com Django
Indexação https://www.elastic.co/downloads/elasticsearch Relevancy score Protocolo Restful Mensagens Json
Indexação Relevance score
Indexação Restful/Json PUT GET
Indexação https://www.elastic.co/use-cases
Indexação O processo de indexação utiliza a lib Elasticsearch-py para
conectar o Python com o Elasticsearch. indexer.py https://pypi.python.org/pypi/elasticsearch https://elasticsearch-py.readthedocs.io/en/master/ https://github.com/elastic/elasticsearch-py Cria um índice Adiciona uma nova página ao índice
Indexação scraper.py O scraper extrai os dados, do arquivo html,
utilizando a lib BeautifulSoup. https://www.crummy.com/software/BeautifulSoup/
scraper.py Indexação Metatags do html
Percorrendo a web - Web crawler crawler.py
Percorrendo a web - Web crawler 1 3 2 4
5 Acessa arquivo robot.txt Download do html Extraí novos links Extraí os dados Insere dados no elasticsearch indexer.py scraper.py crawler.py
Percorrendo a web - Web crawler Antes de “crawlear” uma
página sempre verifique o arquivo “robot.txt”. É uma boa prática. crawler.py
Percorrendo a web - Web crawler A “urllib2” retorna o
html da página. crawler.py
Percorrendo a web- Web crawler crawler.py A extração de novos
links é realizada somente no domínio da url seed.
Percorrendo a web- Web crawler Método que realiza a extração
dos dados presentes no html. scraper.py crawler.py
Percorrendo a web- Web crawler Método que realiza a indexação
das páginas no Elasticsearch. indexer.py crawler.py
Finalizando... Browser (HTML) GET Servidor de aplicação com Django scraper.py
crawler.py indexer.py GET internet
https://github.com/pattyvader https://br.linkedin.com/in/patricia-regina-18790040 Contato *Designed by Freepik from www.flaticon.com*
[email protected]