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
64
0
Share
PyBR12
Patty Vader
October 12, 2016
More Decks by Patty Vader
See All by Patty Vader
Python para Machine Learning
pattyvader
0
32
Search Engines using Python and Elasticsearch
pattyvader
0
190
Pygame
pattyvader
0
85
GitHubWTM
pattyvader
0
47
Other Decks in Programming
See All in Programming
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
140
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
100
実践CRDT
tamadeveloper
0
320
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
150
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
220
安いハードウェアでVulkan
fadis
1
920
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
5.9k
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
220
感情を設計する
ichimichi
5
1.2k
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
860
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing for Performance
lara
611
70k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Writing Fast Ruby
sferik
630
63k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Unsuck your backbone
ammeep
672
58k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Designing for Timeless Needs
cassininazir
0
190
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
88
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
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]