SlideShare a Scribd company logo
1 of 23
Download to read offline
總之來講講 Search 
Andy Dai 
andy@dorm7.com
What is search?
總之來講講 Search
找 Django 相關的⽂文件 
$ grep -ri django * 
docs = Document.objects.filter( 
Q(title__icontain="django")| 
Q(body__icontain="django") 
)
Not Scalable!
這問題其實很早之前就 
被解決了
總之來講講 Search
Inverted Index 
django 
flask 
python 
web 
ruby 
file1 
file1 
file2 
file2 
file1 file2 file3 file4 
file4
search (python and django) 
django 
flask 
python 
web 
ruby 
file1 
file1 
file2 
file2 
file4 
file1 file2 file3 file4 
file4
Phrase Search 
django 
web 
file1 (1,3) 
file1 (2) file2 (3,4) file3 (41) file4 (53)
Search (“django web”) 
django 
web 
file1 (1,3) 
file1 (2) file2 (3,4) file3 (41) file4 (53)
Building Inverted Index 
“Django is a high-level Python Web framework 
that encourages rapid development and clean, 
pragmatic design.” 
django high level python web framework 
encourage rapid development clean pragmatic 
design
What we do 
• Split into tokens 
• Drop stop words 
• Normalize 
• Lowercase 
• stemming
Congratulations! Now you 
can build you own search
今天不是要講 Django 
+ ElasticSearch 嗎?
總之來講講 Search
ElasticSearch 
• Open Source 
• Distributed 
• Document-based 
• JSON over HTTP
總之來講講 Search
Multiple Backends 
• ElasticSearch 
• Whoosh 
• Solr 
• Xapian
pip 
install 
django-­‐haystack 
pip 
install 
elasticsearch
設定 
• setting.py 
• search_indexes.py 
• search template for document
讓我們直接來看 Code 
https://github.com/daikeren/es_test
Q&A

More Related Content

Viewers also liked

Simple stock market analysis
Simple stock market analysisSimple stock market analysis
Simple stock market analysislynneblue
 
Scaling Analytics with elasticsearch
Scaling Analytics with elasticsearchScaling Analytics with elasticsearch
Scaling Analytics with elasticsearchdnoble00
 
Nyc algo meetup_jan_16_14
Nyc algo meetup_jan_16_14Nyc algo meetup_jan_16_14
Nyc algo meetup_jan_16_14twiecki
 
What's new in Elasticsearch v5
What's new in Elasticsearch v5What's new in Elasticsearch v5
What's new in Elasticsearch v5Idan Tohami
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning ElasticsearchAnurag Patel
 
Scipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in PythonScipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in PythonWes McKinney
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlowBayu Aldi Yansyah
 
Developing RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBDeveloping RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBNicola Iarocci
 
Big Data visualization with Apache Spark and Zeppelin
Big Data visualization with Apache Spark and ZeppelinBig Data visualization with Apache Spark and Zeppelin
Big Data visualization with Apache Spark and Zeppelinprajods
 

Viewers also liked (14)

Simple stock market analysis
Simple stock market analysisSimple stock market analysis
Simple stock market analysis
 
Scaling Analytics with elasticsearch
Scaling Analytics with elasticsearchScaling Analytics with elasticsearch
Scaling Analytics with elasticsearch
 
Nyc algo meetup_jan_16_14
Nyc algo meetup_jan_16_14Nyc algo meetup_jan_16_14
Nyc algo meetup_jan_16_14
 
Elasticsearch 5.0
Elasticsearch 5.0Elasticsearch 5.0
Elasticsearch 5.0
 
PyData NYC 2015
PyData NYC 2015PyData NYC 2015
PyData NYC 2015
 
What's new in Elasticsearch v5
What's new in Elasticsearch v5What's new in Elasticsearch v5
What's new in Elasticsearch v5
 
Workshop: Learning Elasticsearch
Workshop: Learning ElasticsearchWorkshop: Learning Elasticsearch
Workshop: Learning Elasticsearch
 
Scipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in PythonScipy 2011 Time Series Analysis in Python
Scipy 2011 Time Series Analysis in Python
 
Elk stack
Elk stackElk stack
Elk stack
 
Ethical hacking with Python tools
Ethical hacking with Python toolsEthical hacking with Python tools
Ethical hacking with Python tools
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlow
 
Google TensorFlow Tutorial
Google TensorFlow TutorialGoogle TensorFlow Tutorial
Google TensorFlow Tutorial
 
Developing RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDBDeveloping RESTful Web APIs with Python, Flask and MongoDB
Developing RESTful Web APIs with Python, Flask and MongoDB
 
Big Data visualization with Apache Spark and Zeppelin
Big Data visualization with Apache Spark and ZeppelinBig Data visualization with Apache Spark and Zeppelin
Big Data visualization with Apache Spark and Zeppelin
 

Similar to 總之來講講 Search

Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017
Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017
Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017Codemotion
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and SemanticsTatiana Al-Chueyr
 
Getting started with Django 1.8
Getting started with Django 1.8Getting started with Django 1.8
Getting started with Django 1.8rajkumar2011
 
Django: Beyond Basics
Django: Beyond BasicsDjango: Beyond Basics
Django: Beyond Basicsarunvr
 
release_python_day1_slides_201606.pdf
release_python_day1_slides_201606.pdfrelease_python_day1_slides_201606.pdf
release_python_day1_slides_201606.pdfPaul Yang
 
gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩gumilab
 
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3makoto tsuyuki
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemGuardSquare
 
Rapid web application development using django - Part (1)
Rapid web application development using django - Part (1)Rapid web application development using django - Part (1)
Rapid web application development using django - Part (1)Nishant Soni
 
Perceval, Graal and Arthur: The Quest for Software Project Data
Perceval, Graal and Arthur: The Quest for Software Project DataPerceval, Graal and Arthur: The Quest for Software Project Data
Perceval, Graal and Arthur: The Quest for Software Project DataValerio Cosentino
 

Similar to 總之來講講 Search (20)

State Of Django
State Of DjangoState Of Django
State Of Django
 
Slides
SlidesSlides
Slides
 
Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017
Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017
Golang and Domain Specific Languages - Lorenzo Fontana - Codemotion Rome 2017
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
Ladypy 01
Ladypy 01Ladypy 01
Ladypy 01
 
django
djangodjango
django
 
Getting started with Django 1.8
Getting started with Django 1.8Getting started with Django 1.8
Getting started with Django 1.8
 
Django
DjangoDjango
Django
 
Django: Beyond Basics
Django: Beyond BasicsDjango: Beyond Basics
Django: Beyond Basics
 
release_python_day1_slides_201606.pdf
release_python_day1_slides_201606.pdfrelease_python_day1_slides_201606.pdf
release_python_day1_slides_201606.pdf
 
gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩
 
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 
Heroku pycon
Heroku pyconHeroku pycon
Heroku pycon
 
Rapid web application development using django - Part (1)
Rapid web application development using django - Part (1)Rapid web application development using django - Part (1)
Rapid web application development using django - Part (1)
 
Django
DjangoDjango
Django
 
Perceval, Graal and Arthur: The Quest for Software Project Data
Perceval, Graal and Arthur: The Quest for Software Project DataPerceval, Graal and Arthur: The Quest for Software Project Data
Perceval, Graal and Arthur: The Quest for Software Project Data
 
Django
DjangoDjango
Django
 
Django Introdcution
Django IntrodcutionDjango Introdcution
Django Introdcution
 
Search in Django
Search in DjangoSearch in Django
Search in Django
 

More from Andy Dai

Grpc + python.key
Grpc + python.keyGrpc + python.key
Grpc + python.keyAndy Dai
 
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?Andy Dai
 
Power UP your CLI
Power UP your CLIPower UP your CLI
Power UP your CLIAndy Dai
 
Search search search
Search search searchSearch search search
Search search searchAndy Dai
 
Django channels
Django channelsDjango channels
Django channelsAndy Dai
 
Django Third party packages
Django Third party packagesDjango Third party packages
Django Third party packagesAndy Dai
 
Practical django secuirty
Practical django secuirtyPractical django secuirty
Practical django secuirtyAndy Dai
 
Python web meetup 11 18
Python web meetup 11 18Python web meetup 11 18
Python web meetup 11 18Andy Dai
 
Django in heavy load environment
Django in heavy load environmentDjango in heavy load environment
Django in heavy load environmentAndy Dai
 
電腦不只會幫你選土豆,還會幫你選新聞
電腦不只會幫你選土豆,還會幫你選新聞電腦不只會幫你選土豆,還會幫你選新聞
電腦不只會幫你選土豆,還會幫你選新聞Andy Dai
 
用 Python 打造你自己的 summly
用 Python 打造你自己的 summly用 Python 打造你自己的 summly
用 Python 打造你自己的 summlyAndy Dai
 
Tradeoffs of replacing core components
Tradeoffs of replacing core componentsTradeoffs of replacing core components
Tradeoffs of replacing core componentsAndy Dai
 
ElastiCache
ElastiCacheElastiCache
ElastiCacheAndy Dai
 
Django deploy
Django deployDjango deploy
Django deployAndy Dai
 
Build your own trello witihin 100 LOC (with Meteor)
Build your own trello witihin 100 LOC (with Meteor)Build your own trello witihin 100 LOC (with Meteor)
Build your own trello witihin 100 LOC (with Meteor)Andy Dai
 
Boost your django admin with Grappelli
Boost your django admin with GrappelliBoost your django admin with Grappelli
Boost your django admin with GrappelliAndy Dai
 

More from Andy Dai (17)

Grpc + python.key
Grpc + python.keyGrpc + python.key
Grpc + python.key
 
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
 
Power UP your CLI
Power UP your CLIPower UP your CLI
Power UP your CLI
 
Search search search
Search search searchSearch search search
Search search search
 
Django channels
Django channelsDjango channels
Django channels
 
Django Third party packages
Django Third party packagesDjango Third party packages
Django Third party packages
 
Practical django secuirty
Practical django secuirtyPractical django secuirty
Practical django secuirty
 
Python web meetup 11 18
Python web meetup 11 18Python web meetup 11 18
Python web meetup 11 18
 
Django in heavy load environment
Django in heavy load environmentDjango in heavy load environment
Django in heavy load environment
 
電腦不只會幫你選土豆,還會幫你選新聞
電腦不只會幫你選土豆,還會幫你選新聞電腦不只會幫你選土豆,還會幫你選新聞
電腦不只會幫你選土豆,還會幫你選新聞
 
用 Python 打造你自己的 summly
用 Python 打造你自己的 summly用 Python 打造你自己的 summly
用 Python 打造你自己的 summly
 
Tradeoffs of replacing core components
Tradeoffs of replacing core componentsTradeoffs of replacing core components
Tradeoffs of replacing core components
 
ElastiCache
ElastiCacheElastiCache
ElastiCache
 
Dynamo db
Dynamo dbDynamo db
Dynamo db
 
Django deploy
Django deployDjango deploy
Django deploy
 
Build your own trello witihin 100 LOC (with Meteor)
Build your own trello witihin 100 LOC (with Meteor)Build your own trello witihin 100 LOC (with Meteor)
Build your own trello witihin 100 LOC (with Meteor)
 
Boost your django admin with Grappelli
Boost your django admin with GrappelliBoost your django admin with Grappelli
Boost your django admin with Grappelli
 

Recently uploaded

Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?AmeliaSmith90
 
20240330_고급진 코드를 위한 exception 다루기
20240330_고급진 코드를 위한 exception 다루기20240330_고급진 코드를 위한 exception 다루기
20240330_고급진 코드를 위한 exception 다루기Chiwon Song
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
Mastering Kubernetes - Basics and Advanced Concepts using Example Project
Mastering Kubernetes - Basics and Advanced Concepts using Example ProjectMastering Kubernetes - Basics and Advanced Concepts using Example Project
Mastering Kubernetes - Basics and Advanced Concepts using Example Projectwajrcs
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfBrain Inventory
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Jaydeep Chhasatia
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdfMeon Technology
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024Mind IT Systems
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorShane Coughlan
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyRaymond Okyere-Forson
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsJaydeep Chhasatia
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadIvo Andreev
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampVICTOR MAESTRE RAMIREZ
 
Kubernetes go-live checklist for your microservices.pptx
Kubernetes go-live checklist for your microservices.pptxKubernetes go-live checklist for your microservices.pptx
Kubernetes go-live checklist for your microservices.pptxPrakarsh -
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...OnePlan Solutions
 

Recently uploaded (20)

Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?
 
20240330_고급진 코드를 위한 exception 다루기
20240330_고급진 코드를 위한 exception 다루기20240330_고급진 코드를 위한 exception 다루기
20240330_고급진 코드를 위한 exception 다루기
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
Mastering Kubernetes - Basics and Advanced Concepts using Example Project
Mastering Kubernetes - Basics and Advanced Concepts using Example ProjectMastering Kubernetes - Basics and Advanced Concepts using Example Project
Mastering Kubernetes - Basics and Advanced Concepts using Example Project
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdf
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
online pdf editor software solutions.pdf
online pdf editor software solutions.pdfonline pdf editor software solutions.pdf
online pdf editor software solutions.pdf
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024
 
Program with GUTs
Program with GUTsProgram with GUTs
Program with GUTs
 
OpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS CalculatorOpenChain Webinar: Universal CVSS Calculator
OpenChain Webinar: Universal CVSS Calculator
 
AI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human BeautyAI Embracing Every Shade of Human Beauty
AI Embracing Every Shade of Human Beauty
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and Bad
 
Sustainable Web Design - Claire Thornewill
Sustainable Web Design - Claire ThornewillSustainable Web Design - Claire Thornewill
Sustainable Web Design - Claire Thornewill
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - Datacamp
 
Kubernetes go-live checklist for your microservices.pptx
Kubernetes go-live checklist for your microservices.pptxKubernetes go-live checklist for your microservices.pptx
Kubernetes go-live checklist for your microservices.pptx
 
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
Transforming PMO Success with AI - Discover OnePlan Strategic Portfolio Work ...
 

總之來講講 Search