SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Solr Community of China
© Copyright www.solr.cc
梁喵
2013年6月16日
全文检索SOLR
Solr Community of China
www.solr.cc
目录
 全文检索概述
 solrcloud4.3+tomcat+zookeeper部署
 lucene/solr 其他功用
Solr Community of China
www.solr.cc
为什么要检索
 要在一大堆信息中,寻找你需要的
 需要借劣一些“线索”
 翻字典要查目录
 找地方看路牌
Solr Community of China
www.solr.cc
什么是索引
 通向你要寻找信息的“线索”
 主要索引类型和方式
 B-tree/ B+tree
 R-tree
 hash
 倒排索引
 索引使用取决于你有什么样的数据和要怎么找
Solr Community of China
www.solr.cc
全文检索核心-倒排索引
全文检索是一种将所有文本与检索项匹配的文字资料检索方法
Solr Community of China
www.solr.cc
检索原理
 寻找既包含字符串“lucene”又包含字符串“solr”的文档(document)
 取出包含字符串“lucene”的文档链表。取出包含字符串“solr”的文档链表。
 合并链表,找出既包含“lucene”又包含“solr”的文件。
Solr Community of China
www.solr.cc
Java全文检索工具Lucene
 Lucene是一个开源的全文检索引擎工具包,它不是一个完整的全文检索引擎
 只是提供完整的建立索引和检索内容能力、部分文本分析功能
 最新版本4.3,附带了全文检索外的许多实用功能。
Solr Community of China
www.solr.cc
Lucene中的分词
 分析器Analyzer
 document的内容按照一定规则打散成Token
Token1 Token2 Tokenk
..........
document
tokenize...
Solr Community of China
www.solr.cc
开源检索解决方案:Solr
 Solr是一个基于Lucene的全文搜索服务器。同时对其进行了扩展,提供了比
Lucene更为丰富的面向使用的查询语言,同时实现了可配置、可扩展并对查询
性能进行了优化,并且提供了一个完善的功能管理界面。是Lucene的子项目
Solr Community of China
www.solr.cc
SolrCloud
 分布式的solr
 1)集中式的配置信息
 2)自劢容错
 3)准实时搜索
 4)查询时自劢负载均衡
 部署:4.3+tomcat+独立zookeeper
Solr Community of China
www.solr.cc
流程
 部署ZK;清除原有的solrcloud节点内容
 解压solr4.3, 拷贝example至solrbase,
 解压solr.war, 修改solr/solr.xml;
 解压tomcat,拷贝至solrbase下
 拷贝solr.war至webapps,增加conf/Catalina/localhost/solr.xml,
 修改conf/server.xml; 修改bin/catalina.sh,
 拷贝solrbase/lib/ext/*和solrbase/resource/* 至tomcat/lib下
 打包solrbase 分发至其他机器,每台机器自行修改bin/catalina.sh的host参数
Solr Community of China
www.solr.cc
Zookeeper
 ZooKeeper is a centralized service for maintaining configuration
information, naming, providing distributed synchronization, and
providing group services
 zoo_example.cfg 改名为zoo.cfg, 修改data的路径
 zooinspector:
https://issues.apache.org/jira/secure/attachment/12436620/ZooInspector.zip
Solr Community of China
www.solr.cc
解压solr4.3, 拷贝example至solrbase
Solr Community of China
www.solr.cc
解压solr.war, 修改solr/solr.xml
 <cores adminPath="/admin/cores" defaultCoreName="collection1"
host="${host:}" hostPort="${jetty.port:8983}"
hostContext="${hostContext:solr}"
zkClientTimeout="${zkClientTimeout:15000}">
 <core name="collection1" instanceDir="collection1" />
 </cores>
Solr Community of China
www.solr.cc
解压tomcat,拷贝至solrbase下
 拷贝solr.war至webapps,
 增加conf/Catalina/localhost/solr.xml
 修改conf/server.xml;
 修改bin/catalina.sh,
 拷贝solrbase/lib/ext/*和solrbase/resource/* 至tomcat/lib下
Solr Community of China
www.solr.cc
打包solrbase 分发至其他机器
 打包solrbase 分发至其他机器,每台机器自行修改bin/catalina.sh的host参数
 同机修改tomcat/下: conf/server.xml三个端口8005 8080 8009
bin/catalina.sh conf/Catalina/localhost/solr.xml
Solr Community of China
www.solr.cc
conf/Catalina/localhost/solr.xml
 <Context docBase="/data/solrbase/tomcat/webapps/solr.war"
debug="0" crossContext="true" >
 <Environment name="solr/home" type="java.lang.String"
value="/data/solrbase/solr/" override="true" />
 </Context>
Solr Community of China
www.solr.cc
bin/catalina.sh
 JAVA_OPTS="-Dhost=vm -Dport=8080 -
Dbootstrap_confdir=/data/solrbase/solr/collection1/conf -
Dcollection.configName=collection1 -DzkHost=vm:2181/solr"
Solr Community of China
www.solr.cc
使用lucene/solr做其他的事
 一个内容, 你想搜啥可以被搜到,就把啥当成token,内容当document
 自劢补全: 北京
• document: [北京, 约XX个]
• token:<b, bj, be,bei, beij, beiji, beijin, beijing, 北>
 纠错提示
• document: [北京你好吗]
• token:<北京, 京你, 你好, 好吗, 北京好吗, 北京你好....>
 推荐算法
• document:某个商品
• token:<和该商品关联的其他商品....>
Solr Community of China
www.solr.cc
谢谢大家
 solr中国qq群:187670960
 solr中国网站:http://www.solr.cc
 我的技术博客:http://blog.csdn.net/lgnlgn

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Solr中国6月16日讲座pp tv2

  • 1. Solr Community of China © Copyright www.solr.cc 梁喵 2013年6月16日 全文检索SOLR
  • 2. Solr Community of China www.solr.cc 目录  全文检索概述  solrcloud4.3+tomcat+zookeeper部署  lucene/solr 其他功用
  • 3. Solr Community of China www.solr.cc 为什么要检索  要在一大堆信息中,寻找你需要的  需要借劣一些“线索”  翻字典要查目录  找地方看路牌
  • 4. Solr Community of China www.solr.cc 什么是索引  通向你要寻找信息的“线索”  主要索引类型和方式  B-tree/ B+tree  R-tree  hash  倒排索引  索引使用取决于你有什么样的数据和要怎么找
  • 5. Solr Community of China www.solr.cc 全文检索核心-倒排索引 全文检索是一种将所有文本与检索项匹配的文字资料检索方法
  • 6. Solr Community of China www.solr.cc 检索原理  寻找既包含字符串“lucene”又包含字符串“solr”的文档(document)  取出包含字符串“lucene”的文档链表。取出包含字符串“solr”的文档链表。  合并链表,找出既包含“lucene”又包含“solr”的文件。
  • 7. Solr Community of China www.solr.cc Java全文检索工具Lucene  Lucene是一个开源的全文检索引擎工具包,它不是一个完整的全文检索引擎  只是提供完整的建立索引和检索内容能力、部分文本分析功能  最新版本4.3,附带了全文检索外的许多实用功能。
  • 8. Solr Community of China www.solr.cc Lucene中的分词  分析器Analyzer  document的内容按照一定规则打散成Token Token1 Token2 Tokenk .......... document tokenize...
  • 9. Solr Community of China www.solr.cc 开源检索解决方案:Solr  Solr是一个基于Lucene的全文搜索服务器。同时对其进行了扩展,提供了比 Lucene更为丰富的面向使用的查询语言,同时实现了可配置、可扩展并对查询 性能进行了优化,并且提供了一个完善的功能管理界面。是Lucene的子项目
  • 10. Solr Community of China www.solr.cc SolrCloud  分布式的solr  1)集中式的配置信息  2)自劢容错  3)准实时搜索  4)查询时自劢负载均衡  部署:4.3+tomcat+独立zookeeper
  • 11. Solr Community of China www.solr.cc 流程  部署ZK;清除原有的solrcloud节点内容  解压solr4.3, 拷贝example至solrbase,  解压solr.war, 修改solr/solr.xml;  解压tomcat,拷贝至solrbase下  拷贝solr.war至webapps,增加conf/Catalina/localhost/solr.xml,  修改conf/server.xml; 修改bin/catalina.sh,  拷贝solrbase/lib/ext/*和solrbase/resource/* 至tomcat/lib下  打包solrbase 分发至其他机器,每台机器自行修改bin/catalina.sh的host参数
  • 12. Solr Community of China www.solr.cc Zookeeper  ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services  zoo_example.cfg 改名为zoo.cfg, 修改data的路径  zooinspector: https://issues.apache.org/jira/secure/attachment/12436620/ZooInspector.zip
  • 13. Solr Community of China www.solr.cc 解压solr4.3, 拷贝example至solrbase
  • 14. Solr Community of China www.solr.cc 解压solr.war, 修改solr/solr.xml  <cores adminPath="/admin/cores" defaultCoreName="collection1" host="${host:}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}" zkClientTimeout="${zkClientTimeout:15000}">  <core name="collection1" instanceDir="collection1" />  </cores>
  • 15. Solr Community of China www.solr.cc 解压tomcat,拷贝至solrbase下  拷贝solr.war至webapps,  增加conf/Catalina/localhost/solr.xml  修改conf/server.xml;  修改bin/catalina.sh,  拷贝solrbase/lib/ext/*和solrbase/resource/* 至tomcat/lib下
  • 16. Solr Community of China www.solr.cc 打包solrbase 分发至其他机器  打包solrbase 分发至其他机器,每台机器自行修改bin/catalina.sh的host参数  同机修改tomcat/下: conf/server.xml三个端口8005 8080 8009 bin/catalina.sh conf/Catalina/localhost/solr.xml
  • 17. Solr Community of China www.solr.cc conf/Catalina/localhost/solr.xml  <Context docBase="/data/solrbase/tomcat/webapps/solr.war" debug="0" crossContext="true" >  <Environment name="solr/home" type="java.lang.String" value="/data/solrbase/solr/" override="true" />  </Context>
  • 18. Solr Community of China www.solr.cc bin/catalina.sh  JAVA_OPTS="-Dhost=vm -Dport=8080 - Dbootstrap_confdir=/data/solrbase/solr/collection1/conf - Dcollection.configName=collection1 -DzkHost=vm:2181/solr"
  • 19. Solr Community of China www.solr.cc 使用lucene/solr做其他的事  一个内容, 你想搜啥可以被搜到,就把啥当成token,内容当document  自劢补全: 北京 • document: [北京, 约XX个] • token:<b, bj, be,bei, beij, beiji, beijin, beijing, 北>  纠错提示 • document: [北京你好吗] • token:<北京, 京你, 你好, 好吗, 北京好吗, 北京你好....>  推荐算法 • document:某个商品 • token:<和该商品关联的其他商品....>
  • 20. Solr Community of China www.solr.cc 谢谢大家  solr中国qq群:187670960  solr中国网站:http://www.solr.cc  我的技术博客:http://blog.csdn.net/lgnlgn