<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/62464f2f62b5053d3cc893ae/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62464f2f62b5053d3cc893ae/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">Lucene 3.0 原理与代码分析完整</div><div class="t m0 x1 h2 y2 ff1 fs0 fc0 sc0 ls0 ws0">版</div><div class="t m0 x1 h3 y3 ff1 fs1 fc0 sc0 ls0 ws0">作者: forfuture1978<span class="_"> </span><span class="fc1">http://forfuture1978.javaeye.com</span></div><div class="t m0 x2 h4 y4 ff1 fs2 fc2 sc0 ls0 ws0">本系列文章将详细描述几乎最新版本的Lucene的基本原理和代码分析。</div><div class="t m0 x3 h4 y5 ff1 fs2 fc2 sc0 ls0 ws0">完整版电子书见博客:</div><div class="t m0 x4 h4 y6 ff1 fs2 fc2 sc0 ls0 ws0">http://forfuture1978.javaeye.com/blog/691017</div><div class="t m0 x5 h5 y7 ff1 fs3 fc1 sc0 ls0 ws0">http://www.javaeye.com<span class="_"> </span><span class="fc0">- 做最棒的软件开发交流社区</span></div><div class="t m0 x6 h6 y8 ff1 fs4 fc2 sc0 ls0 ws0">第 1 / 550 页</div><div class="t m0 x7 h5 y9 ff1 fs3 fc2 sc0 ls0 ws0">本书由JavaEye提供的电子书DIY功能自动生成于 2010-06-26</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.611639,0.000000,0.000000,1.611639,0.000000,0.000000]}'></div></div>
</body>
</html>
<div id="pf2" class="pf w0 h0" data-page-no="2"><div class="pc pc2 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62464f2f62b5053d3cc893ae/bg2.jpg"><div class="t m0 x8 h7 ya ff2 fs5 fc0 sc0 ls0 ws0">目 录</div><div class="t m0 x9 h8 yb ff2 fs1 fc0 sc0 ls0 ws0">1. Lucene 学习总结</div><div class="t m0 x9 h5 yc ff1 fs3 fc1 sc0 ls0 ws0">1.1 Lucene学习总结之一:全文检索的基本原理<span class="_ _0"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _1"> </span>4</div><div class="t m0 x9 h5 yd ff1 fs3 fc1 sc0 ls0 ws0">1.2 Lucene学习总结之二:Lucene的总体架构<span class="_"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _2"></span>22</div><div class="t m0 x9 h5 ye ff1 fs3 fc1 sc0 ls0 ws0">1.3 Lucene学习总结之三:Lucene的索引文件格式 (1)<span class="_ _3"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _2"></span>26</div><div class="t m0 x9 h5 yf ff1 fs3 fc1 sc0 ls0 ws0">1.4 Lucene学习总结之三:Lucene的索引文件格式 (2)<span class="_ _3"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _2"></span>34</div><div class="t m0 x9 h5 y10 ff1 fs3 fc1 sc0 ls0 ws0">1.5 Lucene学习总结之三:Lucene的索引文件格式 (3)<span class="_ _3"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _2"></span>60</div><div class="t m0 x9 h5 y11 ff1 fs3 fc1 sc0 ls0 ws0">1.6 Lucene学习总结之四:Lucene索引过程分析(1)<span class="_ _1"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _2"></span>71</div><div class="t m0 x9 h5 y12 ff1 fs3 fc1 sc0 ls0 ws0">1.7 Lucene学习总结之四:Lucene索引过程分析(2)<span class="_ _1"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _2"></span>90</div><div class="t m0 x9 h5 y13 ff1 fs3 fc1 sc0 ls0 ws0">1.8 Lucene学习总结之四:Lucene索引过程分析(3)<span class="_ _1"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>116</div><div class="t m0 x9 h5 y14 ff1 fs3 fc1 sc0 ls0 ws0">1.9 Lucene学习总结之四:Lucene索引过程分析(4)<span class="_ _1"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>131</div><div class="t m0 x9 h5 y15 ff1 fs3 fc1 sc0 ls0 ws0">1.10 Lucene学习总结之五:Lucene段合并(merge)过程分析<span class="_ _5"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>160</div><div class="t m0 x9 h5 y16 ff1 fs3 fc1 sc0 ls0 ws0">1.11 Lucene学习总结之六:Lucene打分公式的数学推导<span class="_ _6"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>200</div><div class="t m0 x9 h5 y17 ff1 fs3 fc1 sc0 ls0 ws0">1.12 Lucene学习总结之七:Lucene搜索过程解析(1)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>206</div><div class="t m0 x9 h5 y18 ff1 fs3 fc1 sc0 ls0 ws0">1.13 Lucene学习总结之七:Lucene搜索过程解析(2)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>208</div><div class="t m0 x9 h5 y19 ff1 fs3 fc1 sc0 ls0 ws0">1.14 Lucene学习总结之七:Lucene搜索过程解析(3)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>223</div><div class="t m0 x9 h5 y1a ff1 fs3 fc1 sc0 ls0 ws0">1.15 Lucene学习总结之七:Lucene搜索过程解析(4)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>246</div><div class="t m0 x9 h5 y1b ff1 fs3 fc1 sc0 ls0 ws0">1.16 Lucene学习总结之七:Lucene搜索过程解析(5)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>255</div><div class="t m0 x9 h5 y1c ff1 fs3 fc1 sc0 ls0 ws0">1.17 Lucene学习总结之七:Lucene搜索过程解析(6)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>275</div><div class="t m0 x9 h5 y1d ff1 fs3 fc1 sc0 ls0 ws0">1.18 Lucene学习总结之七:Lucene搜索过程解析(7)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>286</div><div class="t m0 x9 h5 y1e ff1 fs3 fc1 sc0 ls0 ws0">1.19 Lucene学习总结之七:Lucene搜索过程解析(8)<span class="_ _2"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>306</div><div class="t m0 x6 h5 y7 ff1 fs3 fc1 sc0 ls0 ws0">http://forfuture1978.javaeye.com</div><div class="t m0 x6 h6 y8 ff1 fs4 fc2 sc0 ls0 ws0">第 2 / 550 页</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.611639,0.000000,0.000000,1.611639,0.000000,0.000000]}'></div></div>
<div id="pf3" class="pf w0 h0" data-page-no="3"><div class="pc pc3 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62464f2f62b5053d3cc893ae/bg3.jpg"><div class="t m0 x9 h5 y1f ff1 fs3 fc1 sc0 ls0 ws0">1.20 Lucene学习总结之八:Lucene的查询语法,JavaCC及QueryParser(1)<span class="_ _2"></span> . . . . . . . . . . . . . . . . . . . .<span class="_ _7"></span>321</div><div class="t m0 x9 h5 y20 ff1 fs3 fc1 sc0 ls0 ws0">1.21 Lucene学习总结之八:Lucene的查询语法,JavaCC及QueryParser(2)<span class="_ _2"></span> . . . . . . . . . . . . . . . . . . . .<span class="_ _7"></span>353</div><div class="t m0 x9 h5 y21 ff1 fs3 fc1 sc0 ls0 ws0">1.22 Lucene学习总结之九:Lucene的查询对象(1)<span class="_ _4"></span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>374</div><div class="t m0 x9 h5 y22 ff1 fs3 fc1 sc0 ls0 ws0">1.23 Lucene学习总结之九:Lucene的查询对象(2)<span class="_ _4"></span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>400</div><div class="t m0 x9 h5 y23 ff1 fs3 fc1 sc0 ls0 ws0">1.24 Lucene学习总结之九:Lucene的查询对象(3)<span class="_ _4"></span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>419</div><div class="t m0 x9 h5 y24 ff1 fs3 fc1 sc0 ls0 ws0">1.25 Lucene学习总结之九:Lucene的查询对象<span class="_ _8"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>444</div><div class="t m0 x9 h5 y25 ff1 fs3 fc1 sc0 ls0 ws0">1.26 Lucene学习总结之十:Lucene的分词器Analyzer<span class="_ _9"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>446</div><div class="t m0 x9 h5 y26 ff1 fs3 fc1 sc0 ls0 ws0">1.27 Lucene 原理与代码分析完整版<span class="_ _3"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>496</div><div class="t m0 x9 h8 y27 ff2 fs1 fc0 sc0 ls0 ws0">2. 有关Lucene的问题</div><div class="t m0 x9 h5 y28 ff1 fs3 fc1 sc0 ls0 ws0">2.1 有关Lucene的问题(1):为什么能搜的到“中华 AND 共和国”却搜不到“中华共和国”?<span class="_ _2"> </span> . . . . . . . .<span class="_ _7"></span>502</div><div class="t m0 x9 h5 y29 ff1 fs3 fc1 sc0 ls0 ws0">2.2 有关Lucene的问题(2):stemming和lemmatization<span class="_"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>506</div><div class="t m0 x9 h5 y2a ff1 fs3 fc1 sc0 ls0 ws0">2.3 有关Lucene的问题(3): 向量空间模型与Lucene的打分机制<span class="_ _3"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _7"></span>514</div><div class="t m0 x9 h5 y2b ff1 fs3 fc1 sc0 ls0 ws0">2.4 有关Lucene的问题(4):影响Lucene对文档打分的四种方式<span class="_ _8"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _a"></span>518</div><div class="t m0 x9 h5 y2c ff1 fs3 fc1 sc0 ls0 ws0">2.5 有关Lucene的问题(5):Lucene中的TooManyClause异常<span class="_ _9"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _a"></span>541</div><div class="t m0 x9 h5 y2d ff1 fs3 fc1 sc0 ls0 ws0">2.6 有关Lucene的问题(6):Lucene的事务性<span class="_ _3"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>542</div><div class="t m0 x9 h5 y2e ff1 fs3 fc1 sc0 ls0 ws0">2.7 有关Lucene的问题(7):用Lucene构建实时的索引<span class="_ _8"> </span> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<span class="_ _4"></span>544</div><div class="t m0 x6 h5 y7 ff1 fs3 fc1 sc0 ls0 ws0">http://forfuture1978.javaeye.com</div><div class="t m0 x6 h6 y8 ff1 fs4 fc2 sc0 ls0 ws0">第 3 / 550 页</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.611639,0.000000,0.000000,1.611639,0.000000,0.000000]}'></div></div>
<div id="pf4" class="pf w0 h0" data-page-no="4"><div class="pc pc4 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62464f2f62b5053d3cc893ae/bg4.jpg"><div class="t m0 xa h9 y2f ff2 fs2 fc1 sc0 ls0 ws0">1.1 Lucene学习总结之一:全文检索的基本原理</div><div class="t m0 xa h5 y30 ff1 fs3 fc0 sc0 ls0 ws0">发表时间: 2009-12-11</div><div class="t m0 xa h5 y31 ff1 fs3 fc0 sc0 ls0 ws0">本文csdn中的位置<span class="fc1">http://blog.csdn.net/forfuture1978/archive/2009/10/22/4711308.aspx</span></div><div class="t m0 xa ha y32 ff2 fs6 fc0 sc0 ls0 ws0">一、总论</div><div class="t m0 xa h5 y33 ff1 fs3 fc0 sc0 ls0 ws0">根据<span class="fc3">http://lucene.apache.org/java/docs/index.html<span class="_ _7"></span></span>定义:</div><div class="t m0 xa hb y34 ff2 fs3 fc0 sc0 ls0 ws0">Lucene是一个高效的,基于Java的全文检索库。</div><div class="t m0 xa h5 y35 ff1 fs3 fc0 sc0 ls0 ws0">所以在了解Lucene之前要费一番工夫了解一下全文检索。</div><div class="t m0 xa h5 y36 ff1 fs3 fc0 sc0 ls0 ws0">那么什么叫做全文检索呢?这要从我们生活中的数据说起。</div><div class="t m0 xa hb y37 ff1 fs3 fc0 sc0 ls0 ws0">我们生活中的数据总体分为两种:<span class="ff2">结构化数据</span>和<span class="ff2">非结构化数据</span>。</div><div class="t m0 xb hb y38 ff1 fs3 fc0 sc0 ls0 ws0">•<span class="_ _b"> </span><span class="ff2">结构化数据:</span>指具有固定格式或有限长度的数据,如数据库,元数据等。</div><div class="t m0 xb hb y39 ff1 fs3 fc0 sc0 ls0 ws0">•<span class="_ _b"> </span><span class="ff2">非结构化数据:</span>指不定长或无固定格式的数据,如邮件,word文档等。</div><div class="t m0 xa h5 y3a ff1 fs3 fc0 sc0 ls0 ws0">当然有的地方还会提到第三种,半结构化数据,如XML,HTML等,当根据需要可按结构化数据来处理,也可</div><div class="t m0 xa h5 y3b ff1 fs3 fc0 sc0 ls0 ws0">抽取出纯文本按非结构化数据来处理。</div><div class="t m0 xa hb y3c ff2 fs3 fc0 sc0 ls0 ws0">非结构化数据又一种叫法叫全文数据。</div><div class="t m0 xa h5 y3d ff1 fs3 fc0 sc0 ls0 ws0">按照数据的分类,搜索也分为两种:</div><div class="t m0 xb hb y3e ff1 fs3 fc0 sc0 ls0 ws0">•<span class="_ _b"> </span><span class="ff2">对结构化数据的搜索</span>:如对数据库的搜索,用SQL语句。再如对元数据的搜索,如利用windows搜索对</div><div class="t m0 x2 h5 y3f ff1 fs3 fc0 sc0 ls0 ws0">文件名,类型,修改时间进行搜索等。</div><div class="t m0 xb hb y40 ff1 fs3 fc0 sc0 ls0 ws0">•<span class="_ _b"> </span><span class="ff2">对非结构化数据的搜索</span>:如利用windows的搜索也可以搜索文件内容,Linux下的grep命令,再如用</div><div class="t m0 x2 h5 y41 ff1 fs3 fc0 sc0 ls0 ws0">Google和百度可以搜索大量内容数据。</div><div class="t m0 xa h5 y42 ff1 fs3 fc0 sc0 ls0 ws0">对非结构化数据也即对全文数据的搜索主要有两种方法:</div><div class="t m0 xa hb y43 ff1 fs3 fc0 sc0 ls0 ws0">一种是<span class="ff2">顺序扫描法(Serial Scanning):</span>所谓顺序扫描,比如要找内容包含某一个字符串的文件,就是一个文档</div><div class="t m0 xa h5 y44 ff1 fs3 fc0 sc0 ls0 ws0">一个文档的看,对于每一个文档,从头看到尾,如果此文档包含此字符串,则此文档为我们要找的文件,接着</div><div class="t m0 xa h5 y45 ff1 fs3 fc0 sc0 ls0 ws0">看下一个文件,直到扫描完所有的文件。如利用windows的搜索也可以搜索文件内容,只是相当的慢。如果你</div><div class="t m0 xa h5 y46 ff1 fs3 fc0 sc0 ls0 ws0">有一个80G硬盘,如果想在上面找到一个内容包含某字符串的文件,不花他几个小时,怕是做不到。Linux下的</div><div class="t m0 xa h5 y47 ff1 fs3 fc0 sc0 ls0 ws0">grep命令也是这一种方式。大家可能觉得这种方法比较原始,但对于小数据量的文件,这种方法还是最直接,</div><div class="t m0 xa h5 y48 ff1 fs3 fc0 sc0 ls0 ws0">最方便的。但是对于大量的文件,这种方法就很慢了。</div><div class="t m0 x6 h5 y7 ff1 fs3 fc1 sc0 ls0 ws0">http://forfuture1978.javaeye.com</div><div class="t m0 xc h3 y49 ff1 fs1 fc0 sc0 ls0 ws0">1.1 Lucene学习总结之一:全文检索的基本原理</div><div class="t m0 x6 h6 y8 ff1 fs4 fc2 sc0 ls0 ws0">第 4 / 550 页</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.611639,0.000000,0.000000,1.611639,0.000000,0.000000]}'></div></div>
<div id="pf5" class="pf w0 h0" data-page-no="5"><div class="pc pc5 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/62464f2f62b5053d3cc893ae/bg5.jpg"><div class="t m0 xa h5 y4a ff1 fs3 fc0 sc0 ls0 ws0">有人可能会说,对非结构化数据顺序扫描很慢,对结构化数据的搜索却相对较快(由于结构化数据有一定的结</div><div class="t m0 xa h5 y4b ff1 fs3 fc0 sc0 ls0 ws0">构可以采取一定的搜索算法加快速度),那么把我们的非结构化数据想办法弄得有一定结构不就行了吗?</div><div class="t m0 xa h5 y4c ff1 fs3 fc0 sc0 ls0 ws0">这种想法很天然,却构成了全文检索的基本思路,也即将非结构化数据中的一部分信息提取出来,重新组织,</div><div class="t m0 xa h5 y4d ff1 fs3 fc0 sc0 ls0 ws0">使其变得有一定结构,然后对此有一定结构的数据进行搜索,从而达到搜索相对较快的目的。</div><div class="t m0 xa hb y4e ff1 fs3 fc0 sc0 ls0 ws0">这部分从非结构化数据中提取出的然后重新组织的信息,我们称之<span class="ff2">索引</span>。</div><div class="t m0 xa h5 y4f ff1 fs3 fc0 sc0 ls0 ws0">这种说法比较抽象,举几个例子就很容易明白,比如字典,字典的拼音表和部首检字表就相当于字典的索引,</div><div class="t m0 xa h5 y50 ff1 fs3 fc0 sc0 ls0 ws0">对每一个字的解释是非结构化的,如果字典没有音节表和部首检字表,在茫茫辞海中找一个字只能顺序扫描。</div><div class="t m0 xa h5 y51 ff1 fs3 fc0 sc0 ls0 ws0">然而字的某些信息可以提取出来进行结构化处理,比如读音,就比较结构化,分声母和韵母,分别只有几种可</div><div class="t m0 xa h5 y52 ff1 fs3 fc0 sc0 ls0 ws0">以一一列举,于是将读音拿出来按一定的顺序排列,每一项读音都指向此字的详细解释的页数。我们搜索时按</div><div class="t m0 xa h5 y53 ff1 fs3 fc0 sc0 ls0 ws0">结构化的拼音搜到读音,然后按其指向的页数,便可找到我们的非结构化数据——也即对字的解释。</div><div class="t m0 xa hb y54 ff2 fs3 fc0 sc0 ls0 ws0">这种先建立索引,再对索引进行搜索的过程就叫全文检索(Full-text Search)。</div><div class="t m0 xa h5 y55 ff1 fs3 fc0 sc0 ls0 ws0">下面这幅图来自《Lucene in action》,但却不仅仅描述了Lucene的检索过程,而是描述了全文检索的一般过</div><div class="t m0 xa h5 y56 ff1 fs3 fc0 sc0 ls0 ws0">程。</div><div class="t m0 x6 h5 y7 ff1 fs3 fc1 sc0 ls0 ws0">http://forfuture1978.javaeye.com</div><div class="t m0 xc h3 y49 ff1 fs1 fc0 sc0 ls0 ws0">1.1 Lucene学习总结之一:全文检索的基本原理</div><div class="t m0 x6 h6 y8 ff1 fs4 fc2 sc0 ls0 ws0">第 5 / 550 页</div><a class="l" rel='nofollow' onclick='return false;'><div class="d m1"></div></a></div><div class="pi" data-data='{"ctm":[1.611639,0.000000,0.000000,1.611639,0.000000,0.000000]}'></div></div>