<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[博客 --- 北京线点科技有限公司]]></title>
<link>http://www.xd-tech.com/blog/</link>
<description><![CDATA[我见青山多妩媚，料青山，见我应如是！jaddy0302@126.com]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog2 v2.4]]></copyright>
<webMaster><![CDATA[jaddy0302@126.com(jaddy0302)]]></webMaster>
<generator>PBlog2 v2.4</generator> 
<image>
	<title>博客 --- 北京线点科技有限公司</title> 
	<url>http://www.xd-tech.com/blog/images/logos.gif</url> 
	<link>http://www.xd-tech.com/blog/</link> 
	<description>博客 --- 北京线点科技有限公司</description> 
</image>

			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=126</link>
			<title><![CDATA[富基旋风移动营销平台]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:30:22 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=126</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/>　　eFuture富基融通科技有限公司是亚太地区零售和消费品行业软件及电子服务的领导供应商之一，2006年10月31日登陆美国NASDAQ资本市场（股票交易代码：EFUT）。中国总部在北京，在上海、广州、武汉设有软件开发基地。现有员工800多名，其中技术团队400多人。全国设有23个办事处，35个城市服务站。2008年正式成立eFuture中国流通研究院。<br/><br/>eFuture富基融通科技有限公司是第一家在NASDAQ上市的中国软件和服务公司，注重国际规范化的公司治理，严格遵从萨班斯法案&nbsp;<br/><br/><br/>项目内容：<br/><br/><br/>　　&nbsp;富基旋风移动营销平台&nbsp;是富基融通公司与新网互联合作提供给超市卖场的一个短信营销平台，其平台框架如下。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=125</link>
			<title><![CDATA[宁夏联通wap平台]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:29:18 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=125</guid>	
		<description><![CDATA[<br/><br/><br/>客户介绍：<br/><br/><br/>　　&nbsp;中国联合网络通信集团有限公司（简称中国联通）于2009年1月6日在原中国网通和原中国联通的基础上合并而成，在国内31个省（自治区、直辖市）和境外多个国家和地区设有分支机构，是中国唯一一家同时在纽约、香港、上海三地上市的电信运营企业。截至2008年底，资产规模达到5266.6亿元人民币，员工总数为46.3万人。&nbsp;<br/><br/>项目内容介绍：<br/><br/><br/>　　&nbsp;宁夏联通wap平台包含了信息发布系统和集团客户应用系统，主要是通过手机wap方式为企业客户提供信息服务和交流平台。<br/><br/>该系统同样是基于J2EE平台架构，包含了短信、彩信、手机wap等多种技术应用。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=124</link>
			<title><![CDATA[江西奉新电力MIS系统]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:28:29 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=124</guid>	
		<description><![CDATA[<br/><br/><br/>项目内容介绍：<br/><br/><br/>　　&nbsp;奉新电力MIS系统是线点科技基于J2EE技术，为江西奉新电力公司开发的集成了OA、设备管理、生产技术管理、调度管理、两票管理、物资管理多个模块的协同办公平台。线点科技充分利用公司资源和技术积累，按时保质地完成了项目开发和实施任务。系统功能框架图如下：<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=123</link>
			<title><![CDATA[深圳电信呼叫中心系统]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:27:40 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=123</guid>	
		<description><![CDATA[<br/>客户介绍：<br/><br/>　　中国电信广东公司是中国电信集团公司最大的省级分公司，总资产近1000亿元，年收入占中国电信股份有限公司的五分之一。&nbsp;2000年以来，累计向国家上缴税收近350亿元。2007年，在广东省50强企业中排行第13位，同年被评为“广东省通信发展突出贡献单位”和“广东省十大国有诚信企业”。截至2008年6月底，固定电话用户2500万户，小灵通用户850万户，宽带用户700万户，均居全国第一，用户规模超过了英国电信、法国电信等欧洲发达国家主导运营商。<br/>　　作为国家主体电信运营企业，中国电信广东公司一直承担着普遍服务、党政专网通信、应急通信、战备通信和抗洪救灾通信保障重任，在广东信息化建设中发挥着骨干作用。<br/><br/><br/>项目内容：<br/><br/><br/>　　&nbsp;深圳电信呼叫中心在08-09年度的系统升级中，面临硬件设备升级改造，网络扩容，软件升级和开发的多项工作，同时在线人工坐席也从1000增加到2000坐席，对于软件的性能、负载能力、无故障持续运行时间的要求都非常高。线点科技在此次扩容工作中，主要承担了其中知识管理、工作流管理的软件开发和集成工作。&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=122</link>
			<title><![CDATA[专利检索系统解决方案]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:23:21 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=122</guid>	
		<description><![CDATA[线点科技凭借多年来在专利行业的研究开发经验，以及大量的客户案例，我们提供从专利数据、业务功能展现、数据分析到硬件平台，基础平台的搭建整套方案。数据规模从几十万到数千万不等。我们服务过的重点客户包括：<br/><br/>北京市知识产权局<br/>上海市知识产权局<br/>长沙市知识产权局<br/>包头稀土研究院<br/>中冶长天<br/>中联重工<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=121</link>
			<title><![CDATA[企业竞争性情报系统解决方案]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:21:31 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=121</guid>	
		<description><![CDATA[企业竞争性情报－对整体竞争环境和竞争对手的一个全面监测过程。是用合法和道德的手段，通过长期系统地跟踪、收集、分析和处理各种可能对企业发展、决策及运行产生影响的信息，最终提炼出本企业及主要对手企业在市场竞争中的优势、劣势和机会的关键情报，从而帮助企业战略规划、投资与购并、研究与发展、市场营销等职能部门的管理者，在信息充分的条件下制定决策。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=120</link>
			<title><![CDATA[企业竞争性情报系统]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:20:36 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=120</guid>	
		<description><![CDATA[产品概述：<br/><br/>&nbsp;&nbsp;中文名称：企业竞争性情报系统<br/>&nbsp;&nbsp;英文简称：XDCIS<br/>&nbsp;&nbsp;当前版本：3.4.x<br/><br/>主要面向客户和应用领域：<br/><br/>&nbsp;&nbsp;大中型企业、研究院所等等<br/><br/>产品描述<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;企业竞争性情报系统是应用了搜索引擎技术，结合企业情报部门、知识管理部门的业务需求，开发的一套集互联网舆情采集、情报收集、审核发布、专题制作、情报门户、流程管理等功能为一体的企业情报工作平台。<br/><br/>功能及特点：<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据系统的需求分析，我们将系统分为情报采集子系统、搜索服务子系统、应用子系统、接口子系统四个部分。&nbsp;<br/>1.&nbsp;情报采集子系统<br/>&nbsp;&nbsp;情报采集子系统包含网页情报的采集、分析、存储等功能。<br/>&nbsp;&nbsp;情报采集子系统的数据采集对象主要是互联网网站和网页，数据源主要有两种，一是通过指定范围的网站对其进行抓取采集，另一种是通过baidu、google进行全网的数据采集监控。<br/>&nbsp;&nbsp;在情报采集过程中，包含了对于正文内容的自动识别、文章去重与相似度分析、自动生成摘要和关键词等多项中文语言处理技术。<br/>&nbsp;&nbsp;此外，情报采集子系统还能够针对网页中的图片、文档资源文件进行采集下载，具有生成网页图片和快照、实现网站自动登录、利用代理服务器下载、JS自动识别判断、分布式采集等多项功能。<br/>&nbsp;&nbsp;在情报数据采集子系统中采用了模版技术，系统内置数百个网站的模版，使得用户的配置过程相当简便。<br/><br/>2.&nbsp;搜索服务子系统<br/>&nbsp;&nbsp;&nbsp;在企业竞争性情报系统中内置了全文检索引擎，可以针对海量情报信息提供快速准确的搜索服务。<br/><br/>3.&nbsp;应用子系统<br/>&nbsp;&nbsp;&nbsp;应用子系统包括情报的分类、编辑、审核、发布、专题创建，门户管理等多个应用模块。<br/><br/>4.&nbsp;接口子系统<br/>&nbsp;&nbsp;&nbsp;接口子系统包括检索接口、索引管理接口、权限接口、单点登录接口等多种<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=119</link>
			<title><![CDATA[专利检索产品]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,27 Aug 2010 16:19:40 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=119</guid>	
		<description><![CDATA[产品概述：<br/><br/>&nbsp;&nbsp;中文名称：专利检索产品<br/>&nbsp;&nbsp;英文简称：XDPMS<br/>&nbsp;&nbsp;当前版本：3.x<br/><br/>主要面向客户和应用领域：<br/><br/>&nbsp;&nbsp;国家知识产权部门、大型企业工厂、研究院所、知识产权注册代理机构等等<br/><br/>产品描述<br/><br/>&nbsp;&nbsp;专利数据检索系统是一款基于语言分析处理技术和文本聚类算法而开发的智能检索系统。目前，该检索系统包括一个智能的数据处理引擎和多个专利数据库，它们分别收集了1976至今的各国英文专利以及1985年至今的中国中文专利文献。<br/><br/>&nbsp;&nbsp;该检索系统不仅提供了基本的表格检索和布尔逻辑检索功能，还引入了概念检索功能，即通过对文档关键概念的自动文本聚类分析，得出与某一概念相关度较高的检索结果，同时可实现多种统计分析功能。此外，该系统含有动态链接的检索界面、灵活的检索入口和友好的操作界面，便于用户进行操作和管理。&nbsp;<br/><br/>功能及特点：<br/><br/>1.&nbsp;多种检索方式支持<br/>&nbsp;&nbsp;&nbsp;系统支持简单检索、表格检索、IPC检索、公式检索、二次检索等多种专利检索方式，并可对检索结果进行关联分析。<br/><br/>2.&nbsp;中英文双语检索<br/>&nbsp;&nbsp;&nbsp;在检索子系统中具有中英文双语检索的功能。即输入中文会自动翻译成英文在选定数据库中进行检索，输入英文自动翻译成中文在选定数据库中进行检索。<br/><br/>3.&nbsp;概念检索<br/>&nbsp;&nbsp;&nbsp;当用户输入一个检索词（如“计算机”）后，检索工具不仅能检索出包含这个具体词汇——计算机——的专利信息，还能检索出包含那些与该词汇同属一类概念的词汇的结果，如与“电脑”、“微型机”、“computer”等相关的信息也能检索出来，从而帮助用户获得最佳的检索效果。<br/><br/>4.&nbsp;数据分析与统计<br/>&nbsp;&nbsp;&nbsp;系统提供了多达几十种多维度、多形式的数据分析与统计功能，包括对时间、发明人、区域、IPC等维度的统计功能，并可通过柱状图、折线图、饼图进行展示。<br/><br/>5.&nbsp;企业自建库<br/>&nbsp;&nbsp;&nbsp;用户可以根据自己的检索结果建立多个逻辑库，并可方便地对逻辑库中的数据进行分析处理。<br/><br/>6.&nbsp;支持多种语言开发接口<br/>&nbsp;&nbsp;&nbsp;产品以标准的WebService方式提供多种语言开发接口，支持的语言包括.NET，JAVA，PHP等。可与各类WEB应用进行无缝集成。同时提供完善的二次开发API手册帮助及应用示例。<br/><br/>7.&nbsp;分布式系统支持<br/>&nbsp;&nbsp;&nbsp;当信息数量超过一台计算机的负载能力，而无法达到要求的查询效率，或是系统需要承受更大的访问压力时，分布式系系统无疑是最好的解决方案。通过分布式系统的支持，系统的数据负载能力可以从300万提高到8000万，甚至更多。<br/><br/>8.&nbsp;操作简易、维护方便<br/>&nbsp;&nbsp;&nbsp;提供完整的后台界面，所有配置和操作都可以通过IE访问产品后台进行，操作简易，维护方便，同时也不影响服务器的安全性。<br/><br/>9.&nbsp;索引自动检测与修复<br/>&nbsp;&nbsp;&nbsp;XDPMS的数据检测机制可以自动修复损坏的数据，最大程度的保证系统可用性。<br/><br/>10.&nbsp;高可用系统负载均衡/集群<br/>&nbsp;&nbsp;&nbsp;完全支持系统负载均衡/集群部署模式，可以支撑电信级系统的运用。<br/><br/>11.&nbsp;数据加密与数据传输安全SSL<br/>&nbsp;&nbsp;&nbsp;为了保障用户数据的安全性，产品在数据存储上采用加密存储方式，防止数据的外泄，在传输上支持SSL的安全传输方式，支持HTTPS安全访问协议。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=118</link>
			<title><![CDATA[海量查询的数据优化（七）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,24 Aug 2010 10:31:14 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=118</guid>	
		<description><![CDATA[<br/>介绍完SARG后，我们来总结一下使用SARG以及在实践中遇到的和某些资料上结论不同的经验：&nbsp;1、Like语句是否属于SARG取决于所使用的通配符的类型&nbsp;如：name&nbsp;like&nbsp;‘张%’&nbsp;，这就属于SARG&nbsp;而：name&nbsp;like&nbsp;‘%张’&nbsp;,就不属于SARG。&nbsp;原因是通配符%在字符串的开通使得索引无法使用。&nbsp;2、or&nbsp;会引起全表扫描&nbsp;Name=’张三’&nbsp;and&nbsp;价格&gt;5000&nbsp;符号SARG，而：Name=’张三’&nbsp;o&#114;&nbsp;价格&gt;5000&nbsp;则不符合SARG。使用or会引起全表扫描。&nbsp;3、非操作符、函数引起的不满足SARG形式的语句&nbsp;不满足SARG形式的语句最典型的情况就是包括非操作符的语句，如：NOT、!=、&lt;&gt;、!&lt;、!&gt;、NOT&nbsp;EXISTS、NOT&nbsp;IN、NOT&nbsp;LIKE等，另外还有函数。下面就是几个不满足SARG形式的例子：&nbsp;ABS(价格)&lt;5000&nbsp;Name&nbsp;like&nbsp;‘%三’&nbsp;有些表达式，如：&nbsp;Wh&#101;re&nbsp;价格*2&gt;5000&nbsp;SQL&nbsp;SERVER也会认为是SARG，SQL&nbsp;SERVER会将此式转化为：&nbsp;Wh&#101;re&nbsp;价格&gt;2500/2&nbsp;但我们不推荐这样使用，因为有时SQL&nbsp;SERVER不能保证这种转化与原始表达式是完全等价的。&nbsp;4、IN&nbsp;的作用相当与OR&nbsp;语句：&nbsp;Sel&#101;ct&nbsp;*&nbsp;from&nbsp;table1&nbsp;wh&#101;re&nbsp;tid&nbsp;in&nbsp;(2,3)&nbsp;和&nbsp;Sel&#101;ct&nbsp;*&nbsp;from&nbsp;table1&nbsp;wh&#101;re&nbsp;tid=2&nbsp;o&#114;&nbsp;tid=3&nbsp;是一样的，都会引起全表扫描，如果tid上有索引，其索引也会失效。&nbsp;5、尽量少用NOT&nbsp;6、exists&nbsp;和&nbsp;in&nbsp;的执行效率是一样的]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=117</link>
			<title><![CDATA[海量查询的数据优化（六）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,16 Aug 2010 14:09:12 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=117</guid>	
		<description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;二、改善SQL语句&nbsp;很多人不知道SQL语句在SQL&nbsp;SERVER中是如何执行的，他们担心自己所写的SQL语句会被SQL&nbsp;SERVER误解。比如：&nbsp;sel&#101;ct&nbsp;*&nbsp;from&nbsp;table1&nbsp;wh&#101;re&nbsp;name=&#39;zhangsan&#39;&nbsp;and&nbsp;tID&nbsp;&gt;&nbsp;10000&nbsp;和执行:&nbsp;sel&#101;ct&nbsp;*&nbsp;from&nbsp;table1&nbsp;wh&#101;re&nbsp;tID&nbsp;&gt;&nbsp;10000&nbsp;and&nbsp;name=&#39;zhangsan&#39;&nbsp;一些人不知道以上两条语句的执行效率是否一样，因为如果简单的从语句先后上看，这两个语句的确是不一样，如果tID是一个聚合索引，那么后一句仅仅从表的&nbsp;10000条以后的记录中查找就行了；而前一句则要先从全表中查找看有几个name=&#39;zhangsan&#39;的，而后再根据限制条件条件tID&gt;&nbsp;10000来提出查询结果。&nbsp;事实上，这样的担心是不必要的。SQL&nbsp;SERVER中有一个“查询分析优化器”，它可以计算出wh&#101;re子句中的搜索条件并确定哪个索引能缩小表扫描的搜索空间，也就是说，它能实现自动优化。&nbsp;虽然查询优化器可以根据wh&#101;re子句自动的进行查询优化，但大家仍然有必要了解一下“查询优化器”的工作原理，如非这样，有时查询优化器就会不按照您的本意进行快速查询。&nbsp;在查询分析阶段，查询优化器查看查询的每个阶段并决定限制需要扫描的数据量是否有用。如果一个阶段可以被用作一个扫描参数（SARG），那么就称之为可优化的，并且可以利用索引快速获得所需数据。&nbsp;SARG的定义：用于限制搜索的一个操作，因为它通常是指一个特定的匹配，一个值得范围内的匹配或者两个以上条件的AND连接。形式如下：&nbsp;列名&nbsp;操作符&nbsp;&lt;常数&nbsp;或&nbsp;变量&gt;&nbsp;或&nbsp;&lt;常数&nbsp;或&nbsp;变量&gt;&nbsp;操作符列名&nbsp;列名可以出现在操作符的一边，而常数或变量出现在操作符的另一边。如：&nbsp;Name=’张三’&nbsp;价格&gt;5000&nbsp;5000&lt;价格&nbsp;Name=’张三’&nbsp;and&nbsp;价格&gt;5000&nbsp;如果一个表达式不能满足SARG的形式，那它就无法限制搜索的范围了，也就是SQL&nbsp;SERVER必须对每一行都判断它是否满足Wh&#101;re子句中的所有条件。所以一个索引对于不满足SARG形式的表达式来说是无用的。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=116</link>
			<title><![CDATA[海量查询的数据优化（五）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Thu,05 Aug 2010 10:15:45 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=116</guid>	
		<description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、使用聚合索引内的时间段，搜索时间会按数据占整个数据表的百分比成比例减少，而无论聚合索引使用了多少个&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&gt;&#39;2004-1-1&#39;&nbsp;用时：6343毫秒（提取100万条）&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&gt;&#39;2004-6-6&#39;&nbsp;用时：3170毫秒（提取50万条）&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi=&#39;2004-9-16&#39;&nbsp;用时：3326毫秒（和上句的结果一模一样。如果采集的数量一样，那么用大于号和等于号是一样的）&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&gt;&#39;2004-1-1&#39;&nbsp;and&nbsp;fariqi&lt;&#39;2004-6-6&#39;&nbsp;用时：3280毫秒<br/>4&nbsp;、日期列不会因为有分秒的输入而减慢查询速度&nbsp;下面的例子中，共有100万条数据，2004年1月1日以后的数据有50万条，但只有两个不同的日期，日期精确到日；之前有数据50万条，有5000个不同的日期，日期精确到秒。&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&gt;&#39;2004-1-1&#39;&nbsp;o&#114;der&nbsp;by&nbsp;fariqi&nbsp;用时：6390毫秒&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&lt;&#39;2004-1-1&#39;&nbsp;o&#114;der&nbsp;by&nbsp;fariqi&nbsp;用时：6453毫秒&nbsp;（五）其他注意事项&nbsp;“水可载舟，亦可覆舟”，索引也一样。索引有助于提高检索性能，但过多或不当的索引也会导致系统低效。因为用户在表中每加进一个索引，数据库就要做更多的工作。过多的索引甚至会导致索引碎片。&nbsp;所以说，我们要建立一个“适当”的索引体系，特别是对聚合索引的创建，更应精益求精，以使您的数据库能得到高性能的发挥。&nbsp;当然，在实践中，作为一个尽职的数据库管理员，您还要多测试一些方案，找出哪种方案效率最高、最为有效。&nbsp;]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=115</link>
			<title><![CDATA[五种开源协议的比较(BSD,Apache,GPL,LGPL,MIT) – 整理]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,28 Jul 2010 10:17:28 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=115</guid>	
		<description><![CDATA[<br/>关键词:&nbsp;Apache,BSD,GPL,LGPL,MIT,协议,开源,扫盲系列<br/>当Adobe、Microsoft、Sun等一系列巨头开始表现出对”开源”的青睐时，”开源”的时代即将到来！<br/>最初来自：sinoprise.com/read.php?tid-662-page-e-fpage-1.html（遗憾的是这个链接已经打不开了），我基本未改动，只是进行了一些排版和整理。<br/>参考文献：<a href="http://www.fsf.org/licensing/licenses/" target="_blank">http://www.fsf.org/licensing/licenses/</a><br/>现今存在的开源协议很多，而经过Open&nbsp;Source&nbsp;Initiative组织通过批准的开源协议目前有58种（<a href="http://www.opensource.org/licenses/alphabetical" target="_blank">http://www.opensource.org/licenses/alphabetical</a>）。我们在常见的开源协议如BSD,&nbsp;GPL,&nbsp;LGPL,MIT等都是OSI批准的协议。如果要开源自己的代码，最好也是选择这些被批准的开源协议。<br/>这里我们来看四种最常用的开源协议及它们的适用范围，供那些准备开源或者使用开源产品的开发人员/厂家参考。<br/>BSD开源协议（original&nbsp;BSD&nbsp;license、FreeBSD&nbsp;license、Original&nbsp;BSD&nbsp;license）<br/>BSD开源协议是一个给于使用者很大自由的协议。基本上使用者可以”为所欲为”,可以自由的使用，修改源代码，也可以将修改后的代码作为开源或者专有软件再发布。<br/>但”为所欲为”的前提当你发布使用了BSD协议的代码，或则以BSD协议代码为基础做二次开发自己的产品时，需要满足三个条件：<br/>1.&#160;&#160;&#160;&#160;如果再发布的产品中包含源代码，则在源代码中必须带有原来代码中的BSD协议。&nbsp;<br/>2.&#160;&#160;&#160;&#160;如果再发布的只是二进制类库/软件，则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。&nbsp;<br/>3.&#160;&#160;&#160;&#160;不可以用开源代码的作者/机构名字和原来产品的名字做市场推广。&nbsp;<br/>BSD&nbsp;代码鼓励代码共享，但需要尊重代码作者的著作权。BSD由于允许使用者修改和重新发布代码，也允许使用或在BSD代码上开发商业软件发布和销售，因此是对商业集成很友好的协议。而很多的公司企业在选用开源产品的时候都首选BSD协议，因为可以完全控制这些第三方的代码，在必要的时候可以修改或者二次开发。<br/>Apache&nbsp;Licence&nbsp;2.0（Apache&nbsp;License,&nbsp;Version&nbsp;2.0、Apache&nbsp;License,&nbsp;Version&nbsp;1.1、Apache&nbsp;License,&nbsp;Version&nbsp;1.0）<br/>Apache&nbsp;Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似，同样鼓励代码共享和尊重原作者的著作权，同样允许代码修改，再发布（作为开源或商业软件）。需要满足的条件也和BSD类似：<br/>1.&#160;&#160;&#160;&#160;需要给代码的用户一份Apache&nbsp;Licence&nbsp;<br/>2.&#160;&#160;&#160;&#160;如果你修改了代码，需要再被修改的文件中说明。&nbsp;<br/>3.&#160;&#160;&#160;&#160;在延伸的代码中（修改和有源代码衍生的代码中）需要带有原来代码中的协议，商标，专利声明和其他原来作者规定需要包含的说明。&nbsp;<br/>4.&#160;&#160;&#160;&#160;如果再发布的产品中包含一个Notice文件，则在Notice文件中需要带有Apache&nbsp;Licence。你可以在Notice中增加自己的许可，但不可以表现为对Apache&nbsp;Licence构成更改。&nbsp;<br/>Apache&nbsp;Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。<br/>GPL（GNU&nbsp;General&nbsp;Public&nbsp;License）<br/>我们很熟悉的Linux就是采用了GPL。GPL协议和BSD,&nbsp;Apache&nbsp;Licence等鼓励代码重用的许可很不一样。GPL的出发点是代码的开源/免费使用和引用/修改/衍生代码的开源/免费使用，但不允许修改后和衍生的代码做为闭源的商业软件发布和销售。这也就是为什么我们能用免费的各种linux，包括商业公司的linux和linux上各种各样的由个人，组织，以及商业软件公司开发的免费软件了。<br/>GPL协议的主要内容是只要在一个软件中使用(“使用”指类库引用，修改后的代码或者衍生代码)GPL&nbsp;协议的产品，则该软件产品必须也采用GPL协议，既必须也是开源和免费。这就是所谓的”传染性”。GPL协议的产品作为一个单独的产品使用没有任何问题，还可以享受免费的优势。<br/>由于GPL严格要求使用了GPL类库的软件产品必须使用GPL协议，对于使用GPL协议的开源代码，商业软件或者对代码有保密要求的部门就不适合集成/采用作为类库和二次开发的基础。<br/>其它细节如再发布的时候需要伴随GPL协议等和BSD/Apache等类似。<br/>LGPL（GNU&nbsp;Lesser&nbsp;General&nbsp;Public&nbsp;License）<br/>LGPL是GPL的一个为主要为类库使用设计的开源协议。和GPL要求任何使用/修改/衍生之GPL类库的的软件必须采用GPL协议不同。LGPL允许商业软件通过类库引用(link)方式使用LGPL类库而不需要开源商业软件的代码。这使得采用LGPL协议的开源代码可以被商业软件作为类库引用并发布和销售。<br/>但是如果修改LGPL协议的代码或者衍生，则所有修改的代码，涉及修改部分的额外代码和衍生的代码都必须采用LGPL协议。因此LGPL协议的开源代码很适合作为第三方类库被商业软件引用，但不适合希望以LGPL协议代码为基础，通过修改和衍生的方式做二次开发的商业软件采用。<br/>GPL/LGPL都保障原作者的知识产权，避免有人利用开源代码复制并开发类似的产品<br/>MIT（MIT）<br/>MIT是和BSD一样宽范的许可协议,作者只想保留版权,而无任何其他了限制.也就是说,你必须在你的发行版里包含原许可协议的声明,无论你是以二进制发布的还是以源代码发布的.<br/>本文来自：<a href="http://www.awflasher.com/blog/archives/939" target="_blank">http://www.awflasher.com/blog/archives/939</a><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=114</link>
			<title><![CDATA[海量查询的数据优化（四）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Thu,15 Jul 2010 10:46:50 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=114</guid>	
		<description><![CDATA[2、只要建立索引就能显著提高查询速度<br/>事实上，我们可以发现上面的例子中，第2、3条语句完全相同，且建立索引的字段也相同；不同的仅是前者在fariqi字段上建立的是非聚合索引，后者在此字段上建立的是聚合索引，但查询速度却有着天壤之别。所以，并非是在任何字段上简单地建立索引就能提高查询速度。&nbsp;<br/><br/>从建表的语句中，我们可以看到这个有着1000万数据的表中fariqi字段有5003个不同记录。在此字段上建立聚合索引是再合适不过了。在现实中，我们每天都会发几个文件，这几个文件的发文日期就相同，这完全符合建立聚集索引要求的：“既不能绝大多数都相同，又不能只有极少数相同”的规则。由此看来，我们建立“适当”的聚合索引对于我们提高查询速度是非常重要的。&nbsp;<br/><br/>3、把所有需要提高查询速度的字段都加进聚集索引，以提高查询速度&nbsp;<br/><br/>上面已经谈到：在进行数据查询时都离不开字段的是“日期”还有用户本身的“用户名”。既然这两个字段都是如此的重要，我们可以把他们合并起来，建立一个复合索引（compound&nbsp;index）。&nbsp;<br/><br/>很多人认为只要把任何字段加进聚集索引，就能提高查询速度，也有人感到迷惑：如果把复合的聚集索引字段分开查询，那么查询速度会减慢吗？带着这个问题，我们来看一下以下的查询速度（结果集都是25万条数据）：（日期列fariqi首先排在复合聚集索引的起始列，用户名neibuyonghu排在后列）&nbsp;<br/><br/>（1）sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&gt;&#39;2004-5-5&#39;&nbsp;<br/><br/>查询速度：2513毫秒&nbsp;<br/><br/>（2）sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi&gt;&#39;2004-5-5&#39;&nbsp;and&nbsp;neibuyonghu=&#39;办公室&#39;&nbsp;<br/><br/>查询速度：2516毫秒&nbsp;<br/><br/>（3）sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;neibuyonghu=&#39;办公室&#39;&nbsp;<br/><br/>查询速度：60280毫秒<br/>从以上试验中，我们可以看到如果仅用聚集索引的起始列作为查询条件和同时用到复合聚集索引的全部列的查询速度是几乎一样的，甚至比用上全部的复合索引列还要略快（在查询结果集数目一样的情况下）；而如果仅用复合聚集索引的非起始列作为查询条件的话，这个索引是不起任何作用的。当然，语句1、2的查询速度一样是因为查询的条目数一样，如果复合索引的所有列都用上，而且查询结果少的话，这样就会形成“索引覆盖”，因而性能可以达到最优。同时，请记住：无论您是否经常使用聚合索引的其他列，但其前导列一定要是使用最频繁的列。&nbsp;<br/><br/>（四）其他书上没有的索引使用经验总结&nbsp;<br/><br/>1、用聚合索引比用不是聚合索引的主键速度快&nbsp;<br/><br/>下面是实例语句：（都是提取25万条数据）&nbsp;<br/><br/>sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;fariqi=&#39;2004-9-16&#39;&nbsp;<br/><br/>使用时间：3326毫秒&nbsp;<br/><br/>sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;gid&lt;=250000&nbsp;<br/><br/>使用时间：4470毫秒&nbsp;<br/><br/>这里，用聚合索引比用不是聚合索引的主键速度快了近1/4。&nbsp;<br/><br/>2、用聚合索引比用一般的主键作order&nbsp;by时速度快，特别是在小数据量情况下&nbsp;<br/><br/>sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;fariqi&nbsp;<br/><br/>用时：12936&nbsp;<br/><br/>sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;<br/><br/>用时：18843<br/>这里，用聚合索引比用一般的主键作order&nbsp;by时，速度快了3/10。事实上，如果数据量很小的话，用聚集索引作为排序列要比使用非聚集索引速度快得明显的多；而数据量如果很大的话，如10万以上，则二者的速度差别不明显。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=113</link>
			<title><![CDATA[海量查询的数据优化（三）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,06 Jul 2010 09:38:40 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=113</guid>	
		<description><![CDATA[<br/>（三）结合实际，谈索引使用的误区&nbsp;<br/><br/>理论的目的是应用。虽然我们刚才列出了何时应使用聚集索引或非聚集索引，但在实践中以上规则却很容易被忽视或不能根据实际情况进行综合分析。下面我们将根据在实践中遇到的实际问题来谈一下索引使用的误区，以便于大家掌握索引建立的方法。&nbsp;<br/><br/>1、主键就是聚集索引&nbsp;<br/><br/>这种想法笔者认为是极端错误的，是对聚集索引的一种浪费。虽然SQL&nbsp;SERVER默认是在主键上建立聚集索引的。&nbsp;<br/><br/>通常，我们会在每个表中都建立一个ID列，以区分每条数据，并且这个ID列是自动增大的，步长一般为1。我们的这个办公自动化的实例中的列Gid就是如此。此时，如果我们将这个列设为主键，SQL&nbsp;SERVER会将此列默认为聚集索引。这样做有好处，就是可以让您的数据在数据库中按照ID进行物理排序，但笔者认为这样做意义不大。&nbsp;<br/><br/>显而易见，聚集索引的优势是很明显的，而每个表中只能有一个聚集索引的规则，这使得聚集索引变得更加珍贵。&nbsp;<br/><br/>从我们前面谈到的聚集索引的定义我们可以看出，使用聚集索引的最大好处就是能够根据查询要求，迅速缩小查询范围，避免全表扫描。在实际应用中，因为ID号是自动生成的，我们并不知道每条记录的ID号，所以我们很难在实践中用ID号来进行查询。这就使让ID号这个主键作为聚集索引成为一种资源浪费。其次，让每个ID号都不同的字段作为聚集索引也不符合“大数目的不同值情况下不应建立聚合索引”规则；当然，这种情况只是针对用户经常修改记录内容，特别是索引项的时候会负作用，但对于查询速度并没有影响。&nbsp;<br/><br/>在办公自动化系统中，无论是系统首页显示的需要用户签收的文件、会议还是用户进行文件查询等任何情况下进行数据查询都离不开字段的是“日期”还有用户本身的“用户名”。&nbsp;<br/><br/>通常，办公自动化的首页会显示每个用户尚未签收的文件或会议。虽然我们的wh&#101;re语句可以仅仅限制当前用户尚未签收的情况，但如果您的系统已建立了很长时间，并且数据量很大，那么，每次每个用户打开首页的时候都进行一次全表扫描，这样做意义是不大的，绝大多数的用户1个月前的文件都已经浏览过了，这样做只能徒增数据库的开销而已。事实上，我们完全可以让用户打开系统首页时，数据库仅仅查询这个用户近3个月来未阅览的文件，通过“日期”这个字段来限制表扫描，提高查询速度。如果您的办公自动化系统已经建立的2年，那么您的首页显示速度理论上将是原来速度8倍，甚至更快。<br/>在这里之所以提到“&nbsp;理论上”三字，是因为如果您的聚集索引还是盲目地建在ID这个主键上时，您的查询速度是没有这么高的，即使您在“日期”这个字段上建立的索引（非聚合索引）。下面我们就来看一下在1000万条数据量的情况下各种查询的速度表现（3个月内的数据为25万条）：&nbsp;<br/><br/>（1）仅在主键上建立聚集索引，并且不划分时间段：&nbsp;<br/><br/>Sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,title&nbsp;from&nbsp;tgongwen&nbsp;<br/><br/>用时：128470毫秒（即：128秒）&nbsp;<br/><br/>（2）在主键上建立聚集索引，在fariq上建立非聚集索引：&nbsp;<br/><br/>sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,title&nbsp;from&nbsp;Tgongwen&nbsp;<br/><br/>wh&#101;re&nbsp;fariqi&gt;&nbsp;dateadd(day,-90,getdate())&nbsp;<br/><br/>用时：53763毫秒（54秒）&nbsp;<br/><br/>（3）将聚合索引建立在日期列（fariqi）上：&nbsp;<br/><br/>sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,title&nbsp;from&nbsp;Tgongwen&nbsp;<br/><br/>wh&#101;re&nbsp;fariqi&gt;&nbsp;dateadd(day,-90,getdate())&nbsp;<br/><br/>用时：2423毫秒（2秒）&nbsp;<br/><br/>虽然每条语句提取出来的都是25万条数据，各种情况的差异却是巨大的，特别是将聚集索引建立在日期列时的差异。事实上，如果您的数据库真的有1000万容量的话，把主键建立在ID列上，就像以上的第1、2种情况，在网页上的表现就是超时，根本就无法显示。这也是我摒弃ID列作为聚集索引的一个最重要的因素。&nbsp;<br/><br/>得出以上速度的方法是：在各个sel&#101;ct语句前加：declare&nbsp;@d&nbsp;datetime<br/>set&nbsp;@d=getdate()&nbsp;<br/><br/>并在sel&#101;ct语句后加：<br/>sel&#101;ct&nbsp;[语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=112</link>
			<title><![CDATA[海量数据的查询优化（二）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,25 Jun 2010 13:36:25 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=112</guid>	
		<description><![CDATA[<br/>（二）何时使用聚集索引或非聚集索引&nbsp;<br/><br/>下面的表总结了何时使用聚集索引或非聚集索引（很重要）。<br/>动作描述&nbsp;<br/>使用聚集索引&nbsp;<br/>使用非聚集索引&nbsp;<br/><br/>列经常被分组排序&nbsp;<br/>应&nbsp;<br/>应&nbsp;<br/><br/>返回某范围内的数据&nbsp;<br/>应&nbsp;<br/>不应&nbsp;<br/><br/>一个或极少不同值&nbsp;<br/>不应&nbsp;<br/>不应&nbsp;<br/><br/>小数目的不同值&nbsp;<br/>应&nbsp;<br/>不应&nbsp;<br/><br/>大数目的不同值&nbsp;<br/>不应&nbsp;<br/>应&nbsp;<br/><br/>频繁更新的列&nbsp;<br/>不应&nbsp;<br/>应&nbsp;<br/><br/>外键列&nbsp;<br/>应&nbsp;<br/>应&nbsp;<br/><br/>主键列&nbsp;<br/>应&nbsp;<br/>应&nbsp;<br/><br/>频繁修改索引列&nbsp;<br/>不应&nbsp;<br/>应<br/>事实上，我们可以通过前面聚集索引和非聚集索引的定义的例子来理解上表。如：返回某范围内的数据一项。比如您的某个表有一个时间列，恰好您把聚合索引建立在了该列，这时您查询2004年1月1日至2004年10月1日之间的全部数据时，这个速度就将是很快的，因为您的这本字典正文是按日期进行排序的，聚类索引只需要找到要检索的所有数据中的开头和结尾数据即可；而不像非聚集索引，必须先查到目录中查到每一项数据对应的页码，然后再根据页码查到具体内容。&nbsp;<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=111</link>
			<title><![CDATA[海量查询的数据优化（一）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,18 Jun 2010 11:21:42 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=111</guid>	
		<description><![CDATA[<br/>一、因情制宜，建立“适当”的索引&nbsp;<br/><br/>建立“适当”的索引是实现查询优化的首要前提。&nbsp;<br/><br/>索引（index）是除表之外另一重要的、用户定义的存储在物理介质上的数据结构。当根据索引码的值搜索数据时，索引提供了对数据的快速访问。事实上，没有索引,数据库也能根据Sel&#101;ct语句成功地检索到结果，但随着表变得越来越大，使用“适当”的索引的效果就越来越明显。注意，在这句话中，我们用了“适当”这个词，这是因为，如果使用索引时不认真考虑其实现过程，索引既可以提高也会破坏数据库的工作性能。&nbsp;<br/><br/>（一）深入浅出理解索引结构&nbsp;<br/><br/>实际上，您可以把索引理解为一种特殊的目录。微软的SQL&nbsp;SERVER提供了两种索引：聚集索引（clustered&nbsp;index，也称聚类索引、簇集索引）和非聚集索引（nonclustered&nbsp;index，也称非聚类索引、非簇集索引）。下面，我们举例来说明一下聚集索引和非聚集索引的区别：&nbsp;<br/><br/>其实，我们的汉语字典的正文本身就是一个聚集索引。比如，我们要查“安”字，就会很自然地翻开字典的前几页，因为“安”的拼音是“an”，而按照拼音排序汉字的字典是以英文字母“a”开头并以“z”结尾的，那么“安”字就自然地排在字典的前部。如果您翻完了所有以“a”开头的部分仍然找不到这个字，那么就说明您的字典中没有这个字；同样的，如果查“张”字，那您也会将您的字典翻到最后部分，因为“张”的拼音是“zhang”。也就是说，字典的正文部分本身就是一个目录，您不需要再去查其他目录来找到您需要找的内容。&nbsp;<br/><br/>我们把这种正文内容本身就是一种按照一定规则排列的目录称为“聚集索引”。&nbsp;<br/><br/>如果您认识某个字，您可以快速地从自动中查到这个字。但您也可能会遇到您不认识的字，不知道它的发音，这时候，您就不能按照刚才的方法找到您要查的字，而需要去根据“偏旁部首”查到您要找的字，然后根据这个字后的页码直接翻到某页来找到您要找的字。但您结合“部首目录”和“检字表”而查到的字的排序并不是真正的正文的排序方法，比如您查“张”字，我们可以看到在查部首之后的检字表中“张”的页码是672页，检字表中“张”的上面是“驰”字，但页码却是63页，“张”的下面是&nbsp;“弩”字，页面是390页。很显然，这些字并不是真正的分别位于“张”字的上下方，现在您看到的连续的“驰、张、弩”三字实际上就是他们在非聚集索引中的排序，是字典正文中的字在非聚集索引中的映射。我们可以通过这种方式来找到您所需要的字，但它需要两个过程，先找到目录中的结果，然后再翻到您所需要的页码。&nbsp;<br/><br/>我们把这种目录纯粹是目录，正文纯粹是正文的排序方式称为“非聚集索引”。&nbsp;<br/><br/>通过以上例子，我们可以理解到什么是“聚集索引”和“非聚集索引”。&nbsp;<br/><br/>进一步引申一下，我们可以很容易的理解：每个表只能有一个聚集索引，因为目录只能按照一种方法进行排序。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=110</link>
			<title><![CDATA[网络舆情的特点及应对]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,08 Jun 2010 14:57:29 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=110</guid>	
		<description><![CDATA[　近年来，网络舆情已经成为社会舆论的重要组成部分，党的十七大报告中也明确提出要“加强网络文化建设和管理，营造良好网络环境”。如何正确看待和有效应对网络舆情是我们党和政府必须深入思考的重要问题。从政府响应、信息透明度、政府公信力三项常规指标和恢复秩序、动态反应、官员问责三项特殊指标的角度就地方政府的网络舆情应对处置能力做出了分析，并提出了一系列应对网络舆情的建议，这对我们以后处理网络舆情具有非常重要的参考价值。网络舆情之所以具有如此重大的影响力，这跟其传播的平台——网络是分不开的，要想正确应对网络舆情，就必须从网络以及网络舆情的特点出发，有针对性地采取应对策略。笔者认为在网络舆情的诸多特点中，有几点须引起重视。<br/>　　网络舆情产生的突发性<br/>　　由于借助论坛、博客等网络平台传播信息简单直接且身份隐蔽，网民能够快速、大胆地发表意见，呼唤声援,在短时间内形成一种力量,以期引起社会和政府的重视。因此网络舆情的形成往往非常迅速，事先没有征兆。一个热点事件的存在加上一种情绪化的意见就能形成星火燎原之势。当前民众对网络运用的热情较之部分地方机关单位的懒于应对,也助长了部分网民对官方“不作为”的负面情绪。这就要求我们要做好网络舆情的应急预案，在舆情发生后最短时间内采取应对措施。由于网上的信息量十分巨大，仅依靠人工的方法难以应对网上海量信息的收集和分析，需要加强相关信息技术的研究，形成一套自动化的网络舆情分析系统，及时发现网络舆情，争取先手。<br/>　　情绪、观点的传染性<br/>　　在应对网络舆情时，不仅需要注重对客观事实真相的揭示，还须重视网民中各种情绪、观点的引导。在网络中“三人成虎”的效果非常明显，即使错误的情绪或观点，如果被多个网民传播，就容易产生极强的说服力，而当一个人形成第一印象后，这种认识就很难改变。到目前为止的绝大多数网络舆情在初始阶段均体现出对某个社会现象的普遍化情绪，这种情绪在网民中迅速传播，产生普遍认识与共鸣，进而推动舆情向更广的范围和更深的领域漫延扩散。如杭州飙车案中，网民先是表现出对死者的悲痛同情、对肇事者漠视生命行为的鄙视和对“富二代”狂妄态度的憎恶，在警方公布70码后，网民又产生对该结论的猜疑与愤怒情绪。在网络舆情中，随着时间的推移，如果没有新的激发因素的介入，网民的情绪会逐渐减退，并朝着理性化方向发展，这时观点的传染性日益重要，官方、民众、专家学者的不同观点在网民中传播、讨论，引导事件走向理性解决。因此，在网络舆情发生后须注意两点，一是仔细分析、掌握真相。在网络舆情发生之初，要充分梳理网民存在的各种情绪，加以正确的安抚、引导，在制定应对方案时，也应考虑网民的情绪。在杭州飙车案发生之初，网民中就有很强的仇富情绪，认为“富人犯法难以与庶民同罪”，而杭州警方草率公布车速为70码，无异于火上浇油，网民对杭州司法机关的不信任和不满情绪由此而生，这种情绪一直到法院判决后都没有得到改观，应引以为戒。二是快速反应，公开透明。依据事实尽快形成官方观点，通过网络、新闻媒体等向公众表达，力求取得公众的认同，使官方的观点能够在网民中广泛传播，民众的知情权得到满足，谣言就会失去市场，相反，麻木、沉默都有可能加剧情绪对立。同时，要重视民间学者的观点，在一些事件中，政府本身就是事件当事人，政府的观点难以得到网民的充分认同，此时民间学者的相对专业和权威的观点则可以起到意想不到的作用。<br/>　　主流观点的道德性<br/>　　道德是社会公认的行为正当与否的衡量标准，一般受到文化、民族、传统、意识形态等因素的影响。在网络中鱼龙混杂，形形色色的观点充斥其中，但最终形成主流的往往是符合中国社会一般道德的观点，这是由于道德是一种为社会普遍认可的行为规范，符合绝大多数民众的价值观、人生观，故能取得多数民众的认同。如在许霆盗窃案、邓玉娇杀人案中，虽然许多法学学者在网上发表了从法学层次上研讨许霆、邓玉娇罪与非罪、罪轻罪重的文章，但是在非法律专业网民中占据主导地位的依然是依据一般道德的认识。在社会舆论中，道德比法律更容易获得民众的普遍认可，因此，在网络舆情发生后，须认真研究其中反映出的公众道德取向，在有客观认识的基础上进行适当的引导、教育。若因其与法律法规等其他社会规范的精神不尽吻合而草率批判、打压，很可能会触发公众的抵触情绪，使问题更难解决，正确的舆论导向也是提高公民素质的重要方法。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=109</link>
			<title><![CDATA[如何做好垂直搜索？(二）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Wed,26 May 2010 16:05:03 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=109</guid>	
		<description><![CDATA[如何做好垂直搜索？（二）<br/>搜索引擎是一个产品，给用户提供服务的产品，需要长期的不断的改进升级调整才能持续不断的提用户体验，需要满足用户不断增长并且变化的需求、需要不断适应网络的变化。这是因为网络环境是不断变化的、网民的需求也是不断变化的。千万不要把搜索当成项目来做，做完了撂那让用户去用那你肯定没戏。在搜索引擎领域是讲体验的、新的引擎如果用户体验一旦整体上有领先一年以上的差距并且持续2年，那前期的领先者的优势就荡然无存，因为搜索引擎的用户转移成本相对而言是比较低的而且口碑是最佳的传播方式。如果一个搜索引擎不能持续不断的技术创新理念创新，那对于这个搜索引擎来说就等于死亡。我们一般形容搜索引擎的领先是以时间计算的。在用户体验面前，任何的炒作都显得很渺小。&nbsp;<br/><br/>作垂直搜索引擎，麻雀虽小，但是五脏俱全。无论理念文化、产品管理、应用、技术都和搜索引擎的楔形理论没有什么区别。所以要做好一垂直搜索必须解决这几个方面。&nbsp;<br/><br/>楔形的尖:垂直搜索技术。&nbsp;&nbsp;<br/>垂直搜索技术主要分为两个层次:模板级和网页库级。模板级是针对网页进行模板设定或者自动生成模板的方式抽取数据，对网页的采集也是针对性的采集，适合规模比较小、信息源少且稳定的需求，优点是快速实施、成本低、灵活性强，缺点是后期维护成本高，信息源和信息量小。网页库级就是在信息源数量上、数据容量上检索容量上、稳定性可*性上都是网页库搜索引擎级别的要求，和模板方式最大的区别是对具体网页不依赖，可针对任意正常的网页进信息采集信息抽取……。这就导致这种方式数据容量上和模板方式有质的区别，但是其灵活性差、成本高。当然模板方式和网页库级的方式不是对立的，这两者对于垂直搜索引擎来说是相互补充的，因为技术只是手段，目的是切反用户之需。本文谈及的技术主要是指网页库级别垂直搜索引擎技术。&nbsp;<br/><br/>搜索引擎的确是一项对技术要求比较高的应用，几年前相关的人才也比较少。现在搜索技术人才多了，相关的技术和技术的应用得相对以前而言更加成熟，但是竞争也更加激烈了。垂直搜索大致需要以下技术：<br/><br/>1.&nbsp;信息采集技术<br/>2.&nbsp;网页信息抽取技术&nbsp;<br/>3.&nbsp;信息的处理技术，包括:重复识别、重复识别、聚类、比较、分析、语料分析等&nbsp;<br/>4.&nbsp;语意相关性分析&nbsp;<br/>5.&nbsp;分词&nbsp;<br/>6.&nbsp;索引&nbsp;<br/>信息采集技术，垂直搜索引擎spider和网页库的spider相比应该是更加专业，可定制化。可定向性的采集和垂直搜索范围相关的网页忽略不相关的网页和不必要的网页，选择内容相关的以及适合做进一步处理的网页深度优先采集、对页面有选择的调整更新频率……，采集可通过人工设定网址和网页分析url方式共同进行。垂直搜索对信息的更新有着特别的要求，根据这些特点可以从以下几点考虑1.信息源的稳定性(不能让信息源网站感觉到spider的压力)2.抓取的成本问题3.对用户体验改善程度。根据以上几点制定一种比较好的策略，要做到恰到好处。策略上可以评估网站/网页更新的系数、网站/网页的重要系数、用户点击系数(或曝光系数)、网站稳定系数……，根据这些系数来确定对这些网站/网页更新的频率。再由于新信息和更新了的信息list页面前面或者首页，所以对网页进行很好的分级可以以低成本很好的解决更新问题，系数比较低的网页一月up&#100;ate一次，稍微高点的一周up&#100;ate一次、中等的几天到一天一次、高的几小时到几分钟一次。类似搜索引擎的大库、周库、日库，小时库……&nbsp;<br/><br/>基于视觉网页块分析技术，模拟IE浏览器的显示方式，对网页进行解析。根据人类视觉原理，把网页解析处理的结果，进行分块，再根据需要，对这些块进行处理，如:采集定向、介绍抽取和一些必要的内容的抽取正文抽取……&nbsp;<br/><br/>结构化信息抽取技术，将网页中的非结构化数据按照一定的需求抽取成结构化数据。有两种方式，简单的就是模板方式，另外就是对网页不依赖web结构化信息抽取方式，这两种方式可以互取长处，以最简单最有效的办法满足需求。垂直搜索引擎和通用搜索引擎最大的区别就是对网页信息结构化抽取后再结构化数据进行深度的处理，提供专业的搜索服务。所以web结构化信息抽取的技术水平是决定垂直搜索引擎质量的重要技术指标。其实web结构化信息抽取在百度、google早已经广泛应用了，如:MP3、图片搜索、google的本地搜索就是从网页库抽取出企业信息，添加到其地图搜索中的，google通过这种技术正在颠覆做内容的方式。同样的技术应用还在qihoo、sogou购物、shopping等各种应用中体现。&nbsp;<br/><br/>简单的语法分析，简单的语法分析在搜索引擎中非常重要，可以通过简单的语法分析来改善数据的质量，低成本的获得某类信息，改善排序，寻找需要的内容……&nbsp;<br/><br/>信息处理技术，信息处理包括的范围比较广，主要包括去重、聚类、分析……，这根据需要相关的技术就非常多。&nbsp;<br/><br/>数据挖掘，找出您的信息的关联性对于垂直搜索来说非常重要，有效，可以在这些相关性上为用户提供更细致的服务。&nbsp;<br/><br/>分词技术，面向搜索的分词技术，建立和您的行业相关的词库。注意这是面向搜索的分词，不是面向识别和准确的分词。就这个工作安排十几个人不停的维护也不会嫌多。&nbsp;<br/><br/>索引技术，索引技术对于垂直搜索非常关键，一个网页库级的搜索引擎必须要支持分布索引、分层建库、分布检索、灵活的更新、灵活的权值调整、灵活的索引和灵活的升级扩展、高可*性稳定性冗余性。还需要支持各种技术的扩展，如偏移量计算等。&nbsp;<br/><br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=108</link>
			<title><![CDATA[如何做好垂直搜索？（一)]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Tue,18 May 2010 16:52:45 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=108</guid>	
		<description><![CDATA[<br/>垂直搜索技术主要分为两个层次:模板级和网页库级。模板级是针对网页进行模板设定或者自动生成模板的方式抽取数据，对网页的采集也是针对性的采集，适合规模比较小、信息源少且稳定的需求，优点是快速实施、成本低、灵活性强，缺点是后期维护成本高，信息源和信息量小。网页库级就是在信息源数量上、数据容量上检索容量上、稳定性可*性上都是网页库搜索引擎级别的要求，和模板方式最大的区别是对具体网页不依赖，可针对任意正常的网页进信息采集信息抽取。这就导致这种方式数据容量上和模板方式有质的区别，但是其灵活性差、成本高。当然模板方式和网页库级的方式不是对立的，这两者对于垂直搜索引擎来说是相互补充的，因为技术只是手段，目的是切返用户之需。本文谈及的技术主要是指网页库级别垂直搜索引擎技术。&nbsp;<br/><br/>搜索引擎的确是一项对技术要求比较高的应用，几年前相关的人才也比较少。现在搜索技术人才多了，相关的技术和技术的应用得相对以前而言更加成熟，但是竞争也更加激烈了。垂直搜索大致需要以下技术:&nbsp;<br/><br/>1.&nbsp;信息采集技术&nbsp;<br/>2.&nbsp;网页信息抽取技术&nbsp;<br/>3.&nbsp;信息的处理技术，包括:重复识别、重复识别、聚类、比较、分析、语料分析等&nbsp;<br/>4.&nbsp;语意相关性分析&nbsp;<br/>5.&nbsp;分词&nbsp;<br/>6.&nbsp;索引&nbsp;本文先引用几句话:&nbsp;&nbsp;<br/>“确解用户之意，切返用户之需。”&nbsp;<br/>“门户网站都想着是怎样省钱，而不是怎样花钱来买技术。”&nbsp;<br/>“搜索引擎不是人人都能做的领域，进入的门槛比较高。”&nbsp;<br/>“只是优秀还不够，最好的方式是将一件事情做到极致。”(google十大真理)&nbsp;<br/>“做搜索引擎需要专注”&nbsp;“对于一项排到第四的业务，门户很难做到专注。”<br/>“用户无法描述道他要找什么，除非让他看到想找的东西。”&nbsp;<br/><br/>“所谓楔形，其实就是个倒三角，倒三角的尖端部分代表搜索技术，中部是基于技术的产品应用平台，最上端是对整个搜索引擎用户人群文化的认识和理解，以及现代公司竞争最关键也最捉摸不定的所谓品牌。”&nbsp;<br/><br/>“楔形”蕴涵的另一个意义是:楔子要打到墙里，尖端是否锐利很重要，但楔子的破坏性有多强，究竟能在墙面挤压出多大的空间，其中端、后端的沉稳与厚重才是关键。&nbsp;<br/><br/>搜索引擎的技术和理念都是需要时间和经验的积累的，更是需要长期不断的完善进步的，绝对不要认为可以一蹴而就，要达到一个相对成熟领先的搜索引擎从开始到领先的周期一般需要是四年。着急不得。原因是因为搜索引擎太复杂，而且“用户无法描述他要找什么，除非让他看到想找的东西。”&nbsp;一切都需要摸索，尝试，问题需要一个一个解决，用户的需要得一点点的挖掘。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=107</link>
			<title><![CDATA[中文搜索引擎技术揭密:系统架构（二）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Mon,10 May 2010 16:45:35 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=107</guid>	
		<description><![CDATA[<br/>搜索引擎的系统架构<br/>&nbsp;&nbsp;&nbsp;&nbsp;这里主要针对全文检索搜索引擎的系统架构进行说明，下文中提到的搜索引擎如果没有特殊说明也是指全文检索搜索引擎。搜索引擎的实现原理，可以看作四步：从互联网上抓取网页→建立索引数据库→在索引数据库中搜索→对搜索结果进行处理和排序。　　<br/>&nbsp;1、从互联网上抓取网页<br/>利用能够从互联网上自动收集网页的网络蜘蛛程序，自动访问互联网，并沿着任何网页中的所有URL爬到其它网页，重复这过程，并把爬过的所有网页收集到服务器中。<br/>2、建立索引数据库<br/>&nbsp;&nbsp;&nbsp;由索引系统程序对收集回来的网页进行分析，提取相关网页信息(包括网页所在URL、编码类型、页面内容包含的关键词、关键词位置、生成时间、大小、与其它网页的链接关系等)，根据一定的相关度算法进行大量复杂计算，得到每一个网页针对页面内容中及超链中每一个关键词的相关度(或重要性)，然后用这些相关信息建立网页索引数据库。<br/>&nbsp;3、在索引数据库中搜索<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当用户输入关键词搜索后，分解搜索请求，由搜索系统程序从网页索引数据库中找到符合该关键词的所有相关网页。<br/>4、对搜索结果进行处理排序<br/>所有相关网页针对该关键词的相关信息在索引库中都有记录，只需综合相关信息和网页级别形成相关度数值，然后进行排序，相关度越高，排名越靠前。最后由页面生成系统将搜索结果的链接地址和页面内容摘要等内容组织起来返回给用户。<br/>搜索引擎的索引和搜索<br/>数据的索引分为三个步骤：网页内容的提取、词的识别、标引库的建立。<br/>&nbsp;&nbsp;&nbsp;&nbsp;互联网上大部分信息都是以HTML格式存在，对于索引来说，只处理文本信息。因此需要把网页中文本内容提取出来，过滤掉一些脚本标示符和一些无用的广告信息，同时记录文本的版面格式信息[1]。词的识别是搜索引擎中非常关键的一部分，通过字典文件对网页内的词进行识别。对于西文信息来说，需要识别词的不同形式，例如：单复数、过去式、组合词、词根等，对于一些亚洲语言(中文、日文、韩文等)需要进行分词处理[3]。识别出网页中的每个词，并分配唯一的wordID号，用于为数据索引中的标引模块服务。<br/>标引库的建立是数据索引中结构最复杂的一部分。一般需要建立两种标引：文档标引和关键词标引。文档标引分配每个网页一个唯一的docID号，根据docID标引出在这个网页中出现过多少过wordID，每个wordID出现的次数、位置、大小写格式等，形成docID对应wordID的数据列表；关键词标引其实是对文档标引的逆标引，根据wordID标引出这个词出现在那些网页(用wordID表示)，出现在每个网页的次数、位置、大小写格式等，形成wordID对应docID的列表。<br/>搜索的处理过程是对用户的搜索请求进行满足的过程，通过用户输入搜索关键字，搜索服务器对应关键词字典，把搜索关键词转化为wordID，然后在标引库中得到docID列表，对docID列表进行扫描和wordID的匹配，提取满足条件的网页，然后计算网页和关键词的相关度，根据相关度的数值返回前K篇结果(不同的搜索引擎每页的搜索结果数不同)返回给用户。如果用户查看的第二页或者第多少页，重新进行搜索，把排序结果中在第K+1到2*K的网页组织返回给用户。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=106</link>
			<title><![CDATA[中国银行经济情报预警平台]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:57:04 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=106</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/>北京讯达恒通信息科技有限公司（“讯达恒通”）是一家专业的金融信息工程公司。讯达恒通以先进的金融管理理念和成熟的信息技术为基础，为银行及其他金融服务机构提供风险管理、决策智能支持、信息科技蓝图规划、信用风险情报预警等多种解决方案，并协助其实施。&nbsp;<br/><br/>讯达恒通的服务可以有效地提升其客户的核心竞争力，应对不断增加的竞争压力。&nbsp;技术和业务相结合、咨询和实施相结合、国际经验和本土环境相结合，是讯达恒通工作的理念。在这样的理念下，讯达恒通汇集了金融工程人才，银行业务及管理人才，金融和IT科技的复合型人才。&nbsp;<br/><br/>讯达恒通致力于引进国际先进经验并创新地运用于国内金融机构。<br/><br/>项目背景：<br/><br/>千里眼经济情报预警平台是北京迅达恒通信息技术有限公司建立的商业信息服务系统，面向国内各大银行提供在线的金融风险预警信息服务，为相关工作人员提供及时、准确地情报信息。<br/><br/>平台的其中两大块功能，一块是互联网的信息、数据抓取，即网络雷达，另一块是海量数据的检索，管理功能，管理功能包括了发布，增加，编辑，删除等等。<br/><br/>其对全文检索产品的要求是响应速度快，不仅在于检索，还在于新增数据的索引，索引的编辑，删除等等，而且对于索引的编辑、删除操作可能非常的频繁。由于是为金融机构提供服务，对于产品的稳定性，无故障运行能力也相当高。<br/><br/>项目内容：<br/><br/><br/>讯达恒通最后选择了线点科技作为其软件产品的供应商，并且线点科技也承担了部分接口开发和集成的工作。<br/><br/>目前，该平台已经提供给多家金融机构进行体验和使用。&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=105</link>
			<title><![CDATA[赶集网多源异构数据检索引擎]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:55:57 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=105</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/>赶集网络（www.ganji.com）是一家座落在北京清华留学生创业园的初创企业，公司由来自美国硅谷的归国人员创办，致力于下一代本地生活资讯网络平台的开发与运营，其管理团队由具有中国互联网多年运营经验的人士组成。赶集网是国内知名的分类信息平台，曾多次获国外风险投资青睐，并作为google的战略合作伙伴。&nbsp;<br/><br/>项目背景：<br/><br/>赶集网是一个分类信息网站，其内容按城市纵向分割，再每个城市按照信息分类进行划分，在网站建设时，采用数据库的方式搭建系统，为不同的城市、不同的分类建立不同的数据库，而这些数据库也是分布在不同的服务器上，彼此之间没有逻辑连接，而且在网站系统建设的不同阶段，使用的操作系统、数据库类型、版本也有所差异，这样就形成了一个个数据孤岛，虽然这样的结构并不妨碍网站的常规功能应用，但是当需要对这些数据进行整合、分析、统计时就遇到了难题，按照常规开发模式，很难对分布在几十台计算机上的不同数据库进行一个统一管理。最典型的应用就是骗子识别，互联网上一些骗子会在不同的城市，不同分类下发布相似或不同的骗子信息，这些可以通过对于所有数据的手机号或email地址的统计得到可疑的信息。<br/><br/>在这样的情况下，赶集网的技术团队需要一个可以适应各种数据库、数据源，能够高效及时对数据进行整合，并提供丰富的开发接口以供他们调用的一个中间件产品。<br/><br/>项目内容：<br/><br/><br/>线点科技的全文检索中间件通过其优异的性能和品质，战胜了其他厂商，成为赶集网的软件产品提供商和技术合作伙伴。<br/><br/>如今，通过线点科技的全文检索产品，赶集网的技术团队能够轻松得开发多项应用，中间件在业务系统与繁多的数据库中间建立一个不透明的连接，而向业务系统提供数据的准确性、高效性与及时性由中间件负责，彻底打破了数据孤岛的瓶颈，也使得网站的应用更为便利。同时，我们的全文检索产品提供有多种语言开发接口，便于不同的技术团队进行开发。另外还值得一提的是，由于我们的全文检索产品采用的是数据库推送方式，在部署时对于数据库的压力相当小，丝毫不影响网站数据库的性能，称为是“完美的解决方案”。&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=104</link>
			<title><![CDATA[搜娱网站内检索系统]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:54:42 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=104</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/><br/>搜娱手机网是北京搜娱网络科技有限公司旗下网站，成立于2006年9月，由业内资深人士和风险资本共同创立，致力于打造一个适合中国人使用的手机门户网站。搜娱手机网从成立发展至今（2007年12月）已累积注册用户200多万，月访问数800多万，月浏览量3000多万。众多用户的认可是我们发展的动力，也是我们孜孜以求的目标之一。搜娱手机网的手机商城现在有2000多家商家入驻，涉及品牌近100家。<br/><br/>项目背景：<br/><br/>搜娱网的信息分有多种分类，数据内容是存储在Sql&nbsp;Server中，面临日益增长的数据量，网站的站内检索性能日益降低，根据网站的用户友好指数，一个页面加载的时间最好是在2秒钟以内，而搜娱网的仅数据库查询时间就至少在5秒钟以上，而且由于一次检索通常都需要多个连表查询，占用数据库连接时间较长，不仅是查询速度慢，也影响了系统的整体性能。<br/><br/>项目内容：<br/><br/><br/>搜娱网在经过权衡比较后，采用了线点科技的站内搜索解决方案，在数据库与应用层之间建立数据中间件，而中间件通过Sql&nbsp;Server的视图功能与数据建立隐射，并通过轮询方式，将数据变化记录下来，以建立索引，如此一来不仅速度问题得到了极大提升，平均检索时间从7秒钟，降低到了0.1秒以内，用户体验也得到了极大的改善，并且在这样的情况下，随着检索频率和次数的增长，并不会给数据库带来压力，我们的中间件充当了压力分流的角色，Sql&nbsp;Server的数据库压力也得到大大缓解。如今，搜娱网的技术总监面临日益增长的数据也可以高枕无忧了<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=103</link>
			<title><![CDATA[港澳资讯股票搜索平台]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:53:33 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=103</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;海南港澳资讯产业股份有限公司是专业从事金融数据库研发、信息技术平台开发、证券资讯终端信息服务、证券投资咨询及互联网相关项目开发的资讯高科技企业，具有中国证监会授予的证券投资咨询从业资格。&nbsp;<br/>　&nbsp;公司于1994年6月成立，2001年7月改制为股份制公司，注册资本3300万元人民币，总部设在海口市，下设上海、深圳、成都、北京及武汉五个分公司，并在全国各主要城市设有13家办事机构，现有员工160多名。&nbsp;<br/><br/>项目背景：<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;随着股票市场的升温，金融资讯行业在近两年得到了极大的发展，中金在线、中国上市公司资讯网，这些网站每天都在新增、发布着各种纷乱复杂的股票信息，特别是股评，个股推荐等重要信息，人们也渴望有一个集中的平台能够对这些信息进行自动的整理归类，列表展示，自动抓取和检索。<br/><br/>项目内容：<br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;港澳资讯作为国内证券资讯行业第一品牌，将此作为公司的一个新的发展方向，通过对北京、上海等地多个知名搜索引擎厂商进行实地调查、产品试用，最终确定选择线点科技作为软件技术提供商，共同打造“搜股易”股票搜索平台。搜股易的搜索目标为行业内近百家知名金融资讯行业网站，栏目近千个，通过对于网站优先级的配置及爬虫的策略，对于热点网站，可达5分钟进行一次数据更新。&nbsp;<br/>搜股易采用HP&nbsp;360服务器，匹配了16G内存，两颗四核CPU，设计数据容量为2000万，更新频率为5分钟至半小时，并使用了独享百M带宽，采用Linux操作系统，在上线一年以来，系统稳定运行，平均每天响应检索次数为20万，高峰时达40万，平均响应时间为0.125秒，整个网站实施周期为两个月，包括前台的页面开发。&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=102</link>
			<title><![CDATA[中国煤科院行业搜索系统]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:52:14 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=102</guid>	
		<description><![CDATA[<br/>客户介绍：<br/><br/>煤炭科学研究总院（以下简称煤科总院）成立于1957年，是我国煤炭行业唯一的大型综合性科研开发机构和技术创新基地，是原煤炭工业部直属的科研事业单位，1999年7月转制为中央直属的科技型企业，2008年6月改革重组，煤科总院成为中国煤炭科工集团有限公司的全资子企业。<br/><br/>经过50年的发展建设，特别是30年的改革开放煤科总院已经建设成为一个学科门类齐全、专业设置合理、研究方向明确、科技力量雄厚、科研成果领先，在国际上具有较高知名度和较大影响力的煤炭科学技术与工程技术的创新中心与研发中心。<br/><br/>项目背景：<br/><br/>此项目属于国家科技基础条件平台项目之一，也是煤科总院的信息化建设的一部分，煤科总院下属有多个网站平台，之前各网站的资源、数据均是独立建设，缺乏整体的规划和部署，现在，需要以一个公共平台的方式将各个系统的数据，例如仪器的数据信息，进行整合，再结合权限系统，达到对数据统一检索，统一管理的目的。数据的形式也是各种各样，包括各种类型的数据库，网页格式的文件，附件等等，因此，不仅是需要从数据库中获取数据内容，也可能是通过http，或ftp协议从其它服务器上来抓取文件，并且提供一个及时的更新响应。<br/><br/>项目内容：<br/><br/><br/>煤科总院最终采用了线点科技提供的解决方案，通过搜索引擎及全文检索引擎对数据进行抓取、整理、整合，由调度服务器对任务之间的工作进行调度，并通过接口对外提供检索服务。&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=101</link>
			<title><![CDATA[用友移动WAP垂直搜索平台]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:50:27 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=101</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/>用友公司成立于1988年，致力于把基于先进信息技术（包括通信技术）的最佳管理与业务实践普及到客户的管理与业务创新活动中，全面提供具有自主知识产权的企业管理/ERP软件、服务与解决方案，是中国最大的管理软件、ERP软件、集团管理软件、人力资源管理软件、客户关系管理软件及小型企业管理软件提供商。目前，中国及亚太地区超过70万家企业与机构通过使用用友软件，实现降低成本、提高效率，加快市场响应速度，提升绩效的业务价值。2001年5月18日，用友软件股份有限公司成功在上海证券交易所发行上市（股票简称：用友软件；股票代码：600588）。&nbsp;<br/><br/>项目背景：<br/><br/>用友软件移动商务部门期望搭建一个基于WAP的生活类垂直搜索平台，通过此平台可以为用户提供诸如餐厅、电影院、咖啡厅之类的生活系统检索服务，这些数据都是经过互联网例如大众点评网，抓取之后再人工进行校正，不仅如此，系统还需能自动抓取评论信息，并能够智能识别，将相关的评论聚合在一起，同时，对于大量数据还需要承担检索的功能。<br/><br/>项目内容：<br/><br/><br/>线点科技作为用友软件的合作伙伴，与用友软件有着多次的合作，特别是用友软件的军工事业部，线点科技承接过其中电集团的领导查询系统和航天科工集团的技术支持网站系统建设。在这次的产品选型中，线点科技的搜索引擎产品一如既往的表现出优异的性能，完全贴近客户的功能体验，再次成为用友的软件技术供应商。&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=100</link>
			<title><![CDATA[ATA全美评测软件公司-实训平台]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,05 May 2010 14:48:02 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=100</guid>	
		<description><![CDATA[<br/><br/>客户介绍：<br/><br/>ATA公司是中国智能化考试服务的创始者，中国最大的考试和教育服务供应商。<br/><br/>ATA公司创立于1999年，成立之初凭借先进的考试理念自主研发了世界领先的动态操作试题考试技术(DST)，向客户提供优化考试解决方案，极大地提高了考试的信度和效度，解决了困扰全球考试业界的众多难题，公司亦获得快速发展。2001年ATA公司凭借长期积累的独特技术和资源优势，依托现代教育理念，积极投身于中国职业教育改革，整合了微软、Adobe等国内外著名IT厂商的优质教育资源，为中国院校提供新型人才培养方案和教学方案，以及全面配套服务与支持。ATA公司凭借富有创新的教育理念、先进的技术打破了传统考试模式、教育模式的弊端，服务于中国人才的选拔、培养，推动了中国考试及教育事业的发展。&nbsp;<br/><br/>项目内容：<br/><br/><br/>线点科技作为ATA的外包服务提供商，为ATA提供其教育平台的开发技术服务。ATA作为软件开发培训机构，素以注重产品质量和规范著称，对于供应商的选择也极为严格，线点科技能够作为其技术提供商，表明线点科技的技术和管理质量都达到了相当高的水准。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=99</link>
			<title><![CDATA[中文搜索引擎技术揭密:系统架构（一）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Wed,28 Apr 2010 10:49:03 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=99</guid>	
		<description><![CDATA[<br/>互联网发展的今天，一方面离不开其开放、共享的特性带给人们的全新体验，另一方面也离不开数以亿计的为其提供各类丰富内容的网络节点。互联网被普及前，人们查阅资料第一想到的便是拥有大量书籍资料的图书馆，到了今天你怎么想？或许今天的很多人都会选择一种更方便、快捷、全面、准确的方式——互联网。你可以坐在家里轻点几下鼠标就查到想要的各类信息，这在互联网没有被普及之前，还都仅是一个梦而已，但如今这一切已成为了现实。<br/>而帮助你通过整个互联网快速查找到目标信息的就是越来越被重视的搜索引擎。有关搜索引擎的技术资料网络上已经很多，关于搜索引擎经济的多方面报道各大媒体也都已经铺天盖地。下面谈一些我对搜索引擎的理解：<br/>搜索引擎技术和分类<br/>搜索引擎的技术基础是全文检索技术，从20世纪60年代，国外对全文检索技术就开始有研究。全文检索通常指文本全文检索，包括信息的存储、组织、表现、查询、存取等各个方面，其核心为文本信息的索引和检索，一般用于企事业单位。随着互联网信息的发展，搜索引擎在全文检索技术上逐渐发展起来，并得到广泛的应用，但搜索引擎还是不同于全文检索。搜索引擎和常规意义上的全文检索主要区别有以下几点：<br/>1.&#160;&#160;&#160;&#160;数据量<br/>传统全文检索系统面向的是企业本身的数据或者和企业相关的数据，一般索引库规模多在GB级，数据量大的也只有几百万条；但互联网网页搜索需要处理几十亿的网页，搜索引擎的策略都是采用服务器群集和分布式计算技术。<br/>2.&#160;&#160;&#160;&#160;内容相关性<br/>信息太多，查准和排序就特别重要，Google等搜索引擎采用网页链接分析技术，根据互联网上网页被链接次数作为重要性评判的依据；但全文检索的数据源中相互链接的程度并不高，不能作为判别重要性的依据，只能基于内容的相关性排序。<br/>3.&#160;&#160;&#160;&#160;安全性<br/>互联网搜索引擎的数据来源都是互联网上公开的信息，而且除了文本正文以外，其它信息都不太重要；但企业全文检索的数据源都是企业内部的信息，有等级、权限等限制，对查询方式也有更严格的要求，因此其数据一般会安全和集中地存放在数据仓库中以保证数据安全和管理的要求。<br/>4.&#160;&#160;&#160;&#160;个性化和智能化<br/>搜索引擎面向的是互联网访问者，由于其数据量和客户数量的限制，自然语言处理技术、知识检索、知识挖掘等计算密集的智能计算技术很难应用，这也是目前搜索引擎技术努力的方向；而全文检索数据量小，检索需求明确，客户量少，在智能化和个性可走得更远。<br/><br/><br/>&nbsp;&#160;&#160;&#160;&#160;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=98</link>
			<title><![CDATA[中文分词（三）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[分词]]></category>
			<pubDate>Fri,16 Apr 2010 11:01:18 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=98</guid>	
		<description><![CDATA[分词中的难题<br/>有了成熟的分词算法，是否就能容易的解决中文分词的问题呢？事实远非如此。中文是一种十分复杂的语言，让计算机理解中文语言更是困难。在中文分词过程中，有两大难题一直没有完全突破。<br/>1、歧义识别<br/>&nbsp;&nbsp;&nbsp;&nbsp;歧义是指同样的一句话，可能有两种或者更多的切分方法。例如：表面的，因为“表面”和“面的”都是词，那么这个短语就可以分成“表面&nbsp;的”和“表&nbsp;面的”。这种称为交叉歧义。像这种交叉歧义十分常见，前面举的“和服”的例子，其实就是因为交叉歧义引起的错误。“化妆和服装”可以分成“化妆&nbsp;和&nbsp;服装”或者“化妆&nbsp;和服&nbsp;装”。由于没有人的知识去理解，计算机很难知道到底哪个方案正确。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;交叉歧义相对组合歧义来说是还算比较容易处理，组合歧义就必需根据整个句子来判断了。例如，在句子“这个门把手坏了”中，“把手”是个词，但在句子“请把手拿开”中，“把手”就不是一个词；在句子“将军任命了一名中将”中，“中将”是个词，但在句子“产量三年中将增长两倍”中，“中将”就不再是词。这些词计算机又如何去识别?<br/>&nbsp;&nbsp;&nbsp;&nbsp;如果交叉歧义和组合歧义计算机都能解决的话，在歧义中还有一个难题，是真歧义。真歧义意思是给出一句话，由人去判断也不知道哪个应该是词，哪个应该不是词。例如：“乒乓球拍卖完了”，可以切分成“乒乓&nbsp;球拍&nbsp;卖&nbsp;完&nbsp;了”、也可切分成“乒乓球&nbsp;拍卖&nbsp;完&nbsp;了”，如果没有上下文其他的句子，恐怕谁也不知道“拍卖”在这里算不算一个词。<br/>2、新词识别<br/>&nbsp;&nbsp;&nbsp;&nbsp;新词，专业术语称为未登录词。也就是那些在字典中都没有收录过，但又确实能称为词的那些词。最典型的是人名，人可以很容易理解句子“王军虎去广州了”中，“王军虎”是个词，因为是一个人的名字，但要是让计算机去识别就困难了。如果把“王军虎”做为一个词收录到字典中去，全世界有那么多名字，而且每时每刻都有新增的人名，收录这些人名本身就是一项巨大的工程。即使这项工作可以完成，还是会存在问题，例如：在句子“王军虎头虎脑的”中，“王军虎”还能不能算词？<br/>&nbsp;&nbsp;&nbsp;&nbsp;新词中除了人名以外，还有机构名、地名、产品名、商标名、简称、省略语等都是很难处理的问题，而且这些又正好是人们经常使用的词，因此对于搜索引擎来说，分词系统中的新词识别十分重要。目前新词识别准确率已经成为评价一个分词系统好坏的重要标志之一。<br/>&nbsp;中文分词的应用<br/>目前在自然语言处理技术中，中文处理技术比西文处理技术要落后很大一段距离，许多西文的处理方法中文不能直接采用，就是因为中文必需有分词这道工序。中文分词是其他中文信息处理的基础，搜索引擎只是中文分词的一个应用。其他的比如机器翻译（MT）、语音合成、自动分类、自动摘要、自动校对等等，都需要用到分词。因为中文需要分词，可能会影响一些研究，但同时也为一些企业带来机会，因为国外的计算机处理技术要想进入中国市场，首先也是要解决中文分词问题。在中文研究方面，相比外国人来说，中国人有十分明显的优势。<br/>&nbsp;&nbsp;&nbsp;&nbsp;分词准确性对搜索引擎来说十分重要，但如果分词速度太慢，即使准确性再高，对于搜索引擎来说也是不可用的，因为搜索引擎需要处理数以亿计的网页，如果分词耗用的时间过长，会严重影响搜索引擎内容更新的速度。因此对于搜索引擎来说，分词的准确性和速度，二者都需要达到很高的要求。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=97</link>
			<title><![CDATA[  中文分词技术（二）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[分词]]></category>
			<pubDate>Tue,06 Apr 2010 11:51:12 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=97</guid>	
		<description><![CDATA[中文分词技术属于自然语言处理技术范畴，对于一句话，人可以通过自己的知识来明白哪些是词，哪些不是词，但如何让计算机也能理解？其处理过程就是分词算法。<br/>&nbsp;&nbsp;&nbsp;现有的分词算法可分为三大类：基于字符串匹配的分词方法、基于理解的分词方法和基于统计的分词方法。<br/>1、基于字符串匹配的分词方法&#160;&#160;&#160;&#160;<br/>&nbsp;&nbsp;&nbsp;&nbsp;这种方法又叫做机械分词方法，它是按照一定的策略将待分析的汉字串与一个“充分大的”机器词典中的词条进行配，若在词典中找到某个字符串，则匹配成功（识别出一个词）。按照扫描方向的不同，串匹配分词方法可以分为正向匹配和逆向匹配；按照不同长度优先匹配的情况，可以分为最大（最长）匹配和最小（最短）匹配；按照是否与词性标注过程相结合，又可以分为单纯分词方法和分词与标注相结合的一体化方法。常用的几种机械分词方法如下：<br/>&nbsp;&nbsp;&nbsp;&nbsp;1）正向最大匹配法（由左到右的方向）；<br/>&nbsp;&nbsp;&nbsp;&nbsp;2）逆向最大匹配法（由右到左的方向）；<br/>&nbsp;&nbsp;&nbsp;&nbsp;3）最少切分（使每一句中切出的词数最小）。<br/>&nbsp;&nbsp;&nbsp;&nbsp;还可以将上述各种方法相互组合，例如，可以将正向最大匹配方法和逆向最大匹配方法结合起来构成双向匹配法。由于汉语单字成词的特点，正向最小匹配和逆向最小匹配一般很少使用。一般说来，逆向匹配的切分精度略高于正向匹配，遇到的歧义现象也较少。统计结果表明，单纯使用正向最大匹配的错误率为1/169，单纯使用逆向最大匹配的错误率为1/245。但这种精度还远远不能满足实际的需要。实际使用的分词系统，都是把机械分词作为一种初分手段，还需通过利用各种其它的语言信息来进一步提高切分的准确率。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一种方法是改进扫描方式，称为特征扫描或标志切分，优先在待分析字符串中识别和切分出一些带有明显特征的词，以这些词作为断点，可将原字符串分为较小的串再来进机械分词，从而减少匹配的错误率。另一种方法是将分词和词类标注结合起来，利用丰富的词类信息对分词决策提供帮助，并且在标注过程中又反过来对分词结果进行检验、调整，从而极大地提高切分的准确率。<br/>对于机械分词方法，可以建立一个一般的模型，在这方面有专业的学术论文，这里不做详细论述。<br/>&nbsp;&nbsp;&nbsp;&nbsp;2、基于理解的分词方法<br/>&nbsp;&nbsp;&nbsp;&nbsp;这种分词方法是通过让计算机模拟人对句子的理解，达到识别词的效果。其基本思想就是在分词的同时进行句法、语义分析，利用句法信息和语义信息来处理歧义现象。它通常包括三个部分：分词子系统、句法语义子系统、总控部分。在总控部分的协调下，分词子系统可以获得有关词、句子等的句法和语义信息来对分词歧义进行判断，即它模拟了人对句子的理解过程。这种分词方法需要使用大量的语言知识和信息。由于汉语语言知识的笼统、复杂性，难以将各种语言信息组织成机器可直接读取的形式，因此目前基于理解的分词系统还处在试验阶段。<br/>&nbsp;&nbsp;&nbsp;3、基于统计的分词方法<br/>&nbsp;&nbsp;&nbsp;&nbsp;从形式上看，词是稳定的字的组合，因此在上下文中，相邻的字同时出现的次数越多，就越有可能构成一个词。因此字与字相邻共现的频率或概率能够较好的反映成词的可信度。可以对语料中相邻共现的各个字的组合的频度进行统计，计算它们的互现信息。定义两个字的互现信息，计算两个汉字X、Y的相邻共现概率。互现信息体现了汉字之间结合关系的紧密程度。当紧密程度高于某一个阈值时，便可认为此字组可能构成了一个词。这种方法只需对语料中的字组频度进行统计，不需要切分词典，因而又叫做无词典分词法或统计取词方法。但这种方法也有一定的局限性，会经常抽出一些共现频度高、但并不是词的常用字组，例如“这一”、“之一”、“有的”、“我的”、“许多的”等，并且对常用词的识别精度差，时空开销大。实际应用的统计分词系统都要使用一部基本的分词词典（常用词词典）进行串匹配分词，同时使用统计方法识别一些新的词，即将串频统计和串匹配结合起来，既发挥匹配分词切分速度快、效率高的特点，又利用了无词典分词结合上下文识别生词、自动消除歧义的优点。<br/>到底哪种分词算法的准确度更高，目前并无定论。对于任何一个成熟的分词系统来说，不可能单独依靠某一种算法来实现，都需要综合不同的算法。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=96</link>
			<title><![CDATA[中文搜索引擎技术揭密:中文分词（一）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Wed,31 Mar 2010 13:16:55 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=96</guid>	
		<description><![CDATA[<br/>什么是中文分词？<br/>众所周知，英文是以词为单位的，词和词之间是靠空格隔开，而中文是以字为单位，句子中所有的字连起来才能描述一个意思。例如，英文句子I&nbsp;am&nbsp;a&nbsp;student，用中文则为：“我是一个学生”。计算机可以很简单通过空格知道student是一个单词，但是不能很容易明白“学”、“生”两个字合起来才表示一个词。把中文的汉字序列切分成有意义的词，就是中文分词，有些人也称为切词。我是一个学生，分词的结果是：我&nbsp;是&nbsp;一个&nbsp;学生。<br/>中文分词和搜索引擎<br/>中文分词到底对搜索引擎有多大影响？对于搜索引擎来说，最重要的并不是找到所有结果，因为在上百亿的网页中找到所有结果没有太多的意义，没有人能看得完，最重要的是把最相关的结果排在最前面，这也称为相关度排序。中文分词的准确与否，常常直接影响到对搜索结果的相关度排序。笔者最近替朋友找一些关于日本和服的资料，在搜索引擎上输入“和服”，得到的结果就发现了很多问题。下面就以这个例子来说明分词对搜索结果的影响，在现有两个中文搜索引擎上做测试，测试方法是直接在Google（<a href="http://www.google.com" target="_blank">http://www.google.com</a>）、百度（<a href="http://www.baidu.com" target="_blank">http://www.baidu.com</a>）上以“和服”为关键词进行搜索：<br/>&nbsp;&nbsp;&nbsp;&nbsp;在Google上输入“和服”搜索所有中文简体网页，总共结果507,000条，前20条结果中有14条与和服一点关系都没有。在第一页就有以下错误：<br/>&nbsp;在Google上输入“和服”搜索所有中文简体网页，总共结果507,000条，前20条结果中有14条与和服一点关系都没有。在第一页就有以下错误：<br/>&nbsp;&nbsp;&nbsp;&nbsp;“通信信息报：瑞星以技术和服务开拓网络安全市场”<br/>&nbsp;&nbsp;&nbsp;&nbsp;“使用纯HTML的通用数据管理和服务-&nbsp;开发者-&nbsp;ZDNet&nbsp;...”<br/>&nbsp;&nbsp;&nbsp;“陈慧琳《心口不一》化妆和服装自己包办”<br/>&nbsp;&nbsp;&nbsp;&nbsp;“外交部：中国境外领事保护和服务指南(2003年版)&nbsp;...”<br/>&nbsp;&nbsp;&nbsp;&nbsp;“产品和服务”<br/>&nbsp;&nbsp;&nbsp;&nbsp;等等。第一页只有三篇是真正在讲“和服”的结果。<br/>&nbsp;&nbsp;&nbsp;&nbsp;在百度上输入“和服”搜索网页，总共结果为287,000条，前20条结果中有6条与和服一点关系都没有。在第一页有以下错误：<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;“福建省晋江市恒和服装有限公司系独资企业”<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;“关于商品和服务实行明码标价的规定”<br/>&nbsp;&nbsp;&nbsp;&nbsp;“青岛东和服装设备”<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这次搜索引擎结果中的错误，就是由于分词的不准确所造成的。通过笔者的了解，Google的中文分词技术采用的是美国一家名叫Basis&nbsp;Technology（<a href="http://www.basistech.com" target="_blank">http://www.basistech.com</a>）的公司提供的中文分词技术，百度使用的是自己公司开发的分词技术。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=95</link>
			<title><![CDATA[使用站内搜索的五大理由]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,31 Mar 2010 13:15:47 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=95</guid>	
		<description><![CDATA[<br/>自从有了计算机以后，人类开始用计算机保存信息，有保存，就有查找，于是检索技术诞生了。文本检索技术的发展从最初的SMART文档检索系统[1]到Altavista搜索引擎，到现在的搜索巨头Google[2]，其发展可谓日新月异、与时具进，人们开始习惯互联网的搜索时代，站内检索的需求也逐渐显露出来。下面列举需要站内检索的五大理由：<br/>一、所寻即所得<br/>信息量总在不断增长，而访问者的耐心却逐渐下降。据统计，每需要多点击一次鼠标，就有三分之一的用户选择放弃。这意味着100个访问者进入我们的网站，如果需要点击三次鼠标才能找到所需要的东西，那么就只剩下不到4个人了。根据第十一次中国互联网信息调查表明，53.1%的人上网是为了获取信息[3]，大部分网站的目的是让外界了解自己，了解的人越多，效果就越好。把访问者最想要的返回给用户，就可让更多的用户了解自己，这样站内检索成为必然选择。<br/>二、了解访问者的意图<br/>管理大师彼得.德鲁克说：“一定要知道你的客户想要什么？”客户的需求永远都是最重要的，因此我们总在分析我们的客户在哪里及他们需要什么。所有访问我们网站的人都可能是我们的潜在客户，了解他们的意图对于我们做决策很重要。站内检索技术可以实现这个功能，站内检索的日志功能可以记录每个访问者的检索词和检索结果，这是访问者意图的最直接的表现。通过分析这些信息，我们还可以调整网站结构，把访问者最想要的放在明显的位置（了解我们的人就多啦）。这个理由经常被人忽视，我在这里放在第二位也是希望引起大家重视，特别是那些已经使用站内检索的网站所有者。<br/>三、&nbsp;&nbsp;符合网民习惯<br/>根据调查表明，68.3％的上网者经常使用搜索引擎[3]。大部分人已经习惯通过检索来找到他们想要的东西，而不是按照某个栏目一级一级往下找(我就很少用yahoo的分类目录）。在网站内访问者要是没看见那熟悉的按钮会多少有些不习惯（我们千万不要让上帝感到不习惯）。在心理学角度讲，人们如果对某个事物不习惯很容易产生厌烦情绪，这也就是为什么你第一次去某个地方会觉得特别远，要是路熟了这种感觉就消失了。看来，为了上帝我们也需要使用站内检索。<br/>四、&nbsp;&nbsp;提升网站信息价值<br/>我们经常会发生这样的事情：明明记得有一篇写关于吃香辣虾的文件，就是想不起存放在什么地方了。访问者也有类似困扰，只记得某个网站上说了关于张国荣跳楼的消息，但不知道具体的链接在哪里。另外，要是隐藏在目录很深的html文档可能自从网站建立到整个网站关闭也没有一个人看过，这些都不是我们所想要的。站内检索毫无疑问可以解决上述问题。同时，按照一个主题把所有相关文档提供给访问者，可以让访问者更全面的了解他所想要的东西，这增加了网站信息间的组织性和逻辑性，方便了访问者的使用，提升用户体验度（用户体验度：一个让我们忐忑不安的名词）<br/><br/><br/>五、&nbsp;身份的象征<br/>有没有站内检索其实已经不只是用户体验度的问题了，还是一个网站专业身份的象征。浏览国外公司的网站，会发现几乎所有网站都在首页最明显的区域放置了一个搜索框，这传达的信息是：专业的网站都有站内检索（呵呵，我没说国外网站就是专业网站）。网民的心态是：我用不用，你管不着，你要是没有就说明你不够专业。为了树立形象，也需要使用站内检索。<br/>最后还得解释一个问题：为什么有了搜索引擎还需要站内检索？用网际搜索引擎不是直接可以查到吗？这其中有两个问题：1&nbsp;搜索羽毛球，你会搜索到235,000个网页[4]，也不知道我公司的排在第10,000页还是10,001页，搜索者可能永远也不会去看。2&nbsp;搜索引擎通过网络Spider收集网页，对于网站内隐藏很深的网页很难索引到的。<br/>当然，目前不选择站内检索的最大理由是成本太高。麻雀虽小五脏俱全，站内检索具有和网际搜索引擎一样的技术构成，价格自然也不会低。如果有很便宜的站内检索系统（5毛钱一斤？），或者是免费的，所有网站都会十分高兴，当然会选择站内检索，那时互联网就步入真正的搜索时代……<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=94</link>
			<title><![CDATA[全文检索]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,31 Mar 2010 13:14:09 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=94</guid>	
		<description><![CDATA[<br/>有专家认为，无论对文献标引的质量如何，对用户检索的满足率都不可能百分之百。例如，用户想检索关于陈毅在抗日战争中活动的文献，采用对标引词(主题词、关键词)字段的检索就很难满足检索要求，只有全文检索才能满足这一检索目的。因此，无论对文献的标引和分类如何，全文检索的功能都是不可替代的。然而，由于全文检索是直接对“原文”的检索，检索时会产生误检，大量的检索垃圾降低了全文检索的查准率，同时由于作者用词的不统一，同义词繁多，全文检索的查全率也受到影响。所以，解决这些问题是刻不容缓的。<br/>1．提高查全率<br/>作者用词的不统一，影响了用户的查全。例如，查找“非典型肺炎”，由于不同的文献使用的词汇不同，如“非典型肺炎”、“SARS”、“非典”等，只用某一词查找就可能出现漏检，如果让用户去列举出所有同义词来检索，势必增加了用户的检索负担。因此，构造全文检索算法时应考虑到检索词的扩充，采用同义词词典无疑是一个好的方法。<br/>同义词词典是把含义相同的词汇关联起来，在全文检索中的作用是，当用户使用某个词汇检索时，系统直接将同义词取出，构成“或”运算检索式，在全文中匹配查询，这样确保了具有高查全率的检索效果。对于同义词词典，应能够及时更新，或具有学习功能，为维护同义词词典提供帮助。<br/>2．提高查准率<br/>由于中文词之间没有间隔标记，所以进行全文检索时极易产生误检索，使查准率偏低。例如，用“华人”一词去检索，会使得含有“中华人民共和国”词汇的文献被检索出来；用“民法’’检索，会把“人民法院”检索出来。解决这类问题同样可通过构造检索辅助词典来完成，而实现这一任务的词典，称为“排除词词典”。<br/>排除词词典的结构为，将检索用词(如民法)与欲排除词(如人民法院、移民法等)关联起来，用于在检索时消除误检。用排除词词典排除误检的做法有许多，最简单的方法是将检索词在每一文献中检索出数量(检索词在文献中出现次数)与所有欲排除词在文献中出现的数量相比较，若相等，该文献就被排除，否则为命中。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=93</link>
			<title><![CDATA[网络舆情监控系统]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:12:29 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=93</guid>	
		<description><![CDATA[<br/>　&nbsp;网络舆情监控系统是指通过对网络各类信息汇集、分类、整合、筛选等技术处理，再形成对网络热点、动态、网民意见等实时统计报表的软件工具。<br/>　　随着互联网的快速发展，网络媒体作为一种新的信息传播形式，已深入人们的日常生活。网友言论活跃已达到前所未有的程度，不论是国内还是国际重大事件，都能马上形成网上舆论，通过这种网络来表达观点、传播思想，进而产生巨大的舆论压力，达到任何部门、机构都无法忽视的地步。可以说，互联网已成为思想文化信息的集散地和社会舆论的放大器。<br/>　　舆情监控系统通过对热点问题和重点领域比较集中的网站信息，如：网页、论坛、BBS等，进行24小时监控，随时下载最新的消息和意见。下载后完成对数据格式的转换及元数据的标引。对下载本地的信息，进行初步的过滤和预处理。对热点问题和重要领域实施监控，前提是必须通过人际交互建立舆情监控的知识库，用来指导智能分析的过程。对热点问题的智能分析，首先基于传统基于向量空间的特征分析技术上，对抓取的内容做分类、聚类和摘要分析，对信息完成初步的再组织。然后在监控知识库的指导下进行基于舆情的语义分析，使管理者看到的民情民意更有效，更符合现实。最后将监控的结果，分别推送到不同的职能部门，供制定对策使用。<br/>　　网络舆情监控系统是利用搜索引擎技术和网络信息挖掘技术，通过网页内容的自动采集处理、敏感词过滤、智能聚类分类、主题检测、专题聚焦、统计分析，实现各单位对自己相关网络舆情监督管理的需要，最终形成舆情简报、舆情专报、分析报告、移动快报，为决策层全面掌握舆情动态，做出正确舆论引导，提供分析依据。<br/>　　“网络舆情监测系统”是针对在一定的社会空间内，围绕中介性社会事件的发生、发展和变化，民众对社会管理者产生和持有的社会政治态度于网络上表达出来意愿集合而进行的计算机监测的系统统称。<br/>　　“网络舆情”是较多群众关于社会中各种现象、问题所表达的信念、态度、意见和情绪等等表现的总和。网络舆情形成迅速，对社会影响巨大，加强互联网信息监管的同时，组织力量开展信息汇集整理和分析，对于及时应对网络突发的公共事件和全面掌握社情民意很有意义。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=92</link>
			<title><![CDATA[垂直搜索和开放式搜索的技术模式之异同]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:10:49 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=92</guid>	
		<description><![CDATA[<br/>一、垂直搜索和开放式搜索的相同点主要是：<br/>　　1．都是解决用户从海量信息中找到自己想要信息的目的；<br/>　　2．基本技术都是信息检索；<br/>　　3．对中文语言而言，都需要中文分词等关键技术；<br/>　　4．都需要spider获取外部信息；<br/>二、垂直搜索和开放式网页搜索的不同点：<br/>　　1．产生的背景不同：开发网页搜索的产生背景是因为互联网上的网页太多，用户无法找到自己想要的网页，而垂直搜索的产生是因为两个原因：第一，用户从开放式的网页搜索中想要找到自己想要的某一个特定领域的信息时，需要花费大量的时间。例如，对于求职而言，如果用户在google中输入“java开发”，得到的结果都是讲java开发技巧的，要想看到关于“java开发”的职位，需要用不断的翻页；垂直搜索产生的第二个原因是，领域性网站数量的日益增多，拿招聘来说，现在国内的招聘网站可以说是几百家，除了51job、chinahr、zhaopin这样的门户之外，各地还有自己的招聘门户，因此，用户想要得到全面的招聘信息，就需要一个网站一个网站打开去看，耗时耗力！<br/>　　2．受限领域：垂直搜索一定是针对用户在某一个方面的需求，专门搜索该方面的内容，例如：票务搜索、房地产搜索、汽车搜索、招聘搜索……<br/>　　3．定向spider：垂直搜索所用的spider和google、baidu所用的spider并不一样，当然开发的基本思想是一样的。只是垂直搜索的spider是针对已经收集好的website&nbsp;list进行爬取4.信息抽取：垂直搜索中一项很关键技术就是信息抽取（IE：Information&nbsp;Extraction）。网页搜索引擎（google）是针对去掉广告内容后的整个网页内容进行索引，然后呈现给用户的也是一个网页。而垂直搜索往往需要对爬下来网页中的部分内容进行索引，同时呈现给用户的也是经过抽取整理后的内容，而不是一个简单的summary加上网页链接。<br/>　　4．排序技术：通常我们所知道的排序都是PR（page&nbsp;rank），google有google的pr技术，baidu有baidu的pr技术，但基本思想就是做网页的链接分析：包含一个关键词的网页有10万个，那到底哪个该排在第一个。网页搜索引擎通常都是分析一个网页中链接了多少个其它的网页，加上其它网页链接到这个网页有多少个，再加上更新时间，然后做一个数学运算得到最后的排序权值。垂直搜索的排序就和机遇链接分析的方法大不相同。链接分析的pr方法，需要爬取海量的网页信息，而垂直搜索并没有这样的海量数据，所以客观上的条件不允许做链接分析。同时垂直搜索的用户需求决定了常用的排序依据：内容相关性、实时性。因此，我们看到现在所有的垂直搜索都采用了按相关性和时间交叉排序的方法。<br/>　　5．结果页面呈现方式：垂直搜索的结果页面呈现通常都是除了给出检索结果的title、summary、time、url等基本信息之外，还要给出一些经过信息抽取之后的内容：例如，房地产垂直搜索要给出地点、价格等信息，招聘垂直搜索要给出招聘单位名称、地点等信息。票务垂直搜索要给出预定机构，价格，预定方法等信息<br/>　　6．核心技术：开放式的网页搜索引擎（google、baidu）的核心技术通常是：分布式存储、分布式检索、网页链接分析、自动摘要等技术。垂直搜索的核心技术主要是全文检索、信息抽取。相比之下，垂直搜索在自动摘要方面做得研究都很少，简单的拿出原文中的一定字数内容就可以做摘要。<br/>　　7．索引结构：垂直搜索是对抽取后的内容分字段索引，而开发网页搜索是对整个页面进行索引。<br/>线点科技的垂直搜索产品既是针对特定领域，和确定范围内网站的内容提供定向搜索服务的产品，但同时也融合了开放式搜索技术的一些特点和优点，从而能够给客户提供更优的搜索体验。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=91</link>
			<title><![CDATA[用 Lucene 加速 Web 搜索应用程序的开发（五）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:09:17 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=91</guid>	
		<description><![CDATA[5．在&nbsp;Tomcat&nbsp;5.0&nbsp;上运行应用程序<br/>现在我们可以在&nbsp;Tomcat&nbsp;5.0&nbsp;上运行开发好的应用程序。&nbsp;<br/>1.&#160;&#160;&#160;&#160;右键单击&nbsp;search.jsp，然后选择&nbsp;Run&nbsp;as&nbsp;&gt;&nbsp;Run&nbsp;on&nbsp;Server，如图7所示。&nbsp;<br/><br/><br/>图7：配置&nbsp;Tomcat&nbsp;5.0<br/>&nbsp;在弹出的窗口中，选择&nbsp;Tomcat&nbsp;v5.0&nbsp;Server&nbsp;作为目标&nbsp;Web&nbsp;应用程序服务器，然后点击&nbsp;Next，如图8&nbsp;所示：<br/>选择&nbsp;Tomcat&nbsp;5.0<br/>&nbsp;<br/>3.&#160;&#160;&#160;&#160;现在需要指定用来运行&nbsp;Web&nbsp;应用程序的&nbsp;Apache&nbsp;Tomcat&nbsp;5.0&nbsp;以及&nbsp;JRE&nbsp;的路径。这里你所选择的&nbsp;JRE&nbsp;的版本必须和你用来编译&nbsp;Java&nbsp;文件的&nbsp;JRE&nbsp;的版本一致。配置好之后，点击&nbsp;如&nbsp;图9&nbsp;所示。&nbsp;图9：完成Tomcat&nbsp;5.0的配置<br/>&nbsp;<br/>4.&#160;&#160;&#160;&#160;配置好之后，Tomcat&nbsp;会自动运行，并且会对&nbsp;search.jsp&nbsp;进行编译并显示给用户。如&nbsp;图10&nbsp;所示。&nbsp;<br/>图10：用户&nbsp;界面在输入框中输入关键词&nbsp;“information”&nbsp;然后单击&nbsp;Search&nbsp;按钮。然后这个页面上会显示出搜索结果来，如&nbsp;图11&nbsp;所示。&nbsp;图11：搜索结果<br/>&nbsp;<br/>单击搜索结果的第一个链接，页面上就会显示出所链接到的页面的内容。如&nbsp;图12&nbsp;所示.&nbsp;图12：详细信息<br/>&nbsp;<br/>现在我们已经成功的完成了示例项目的开发，并成功的用Lucene实现了搜索和索引功能。你可以下载这个项目的源代码（下载）。&nbsp;<br/>总结<br/>Lucene&nbsp;提供了灵活的接口使我们更加方便的设计我们的&nbsp;Web&nbsp;搜索应用程序。如果你想在你的应用程序中加入搜索功能，那么&nbsp;Lucene&nbsp;是一个很好的选择。在设计你的下一个带有搜索功能的应用程序的时候可以考虑使用&nbsp;Lucene&nbsp;来提供搜索功能。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=90</link>
			<title><![CDATA[用 Lucene 加速 Web 搜索应用程序的开发（四）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:08:05 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=90</guid>	
		<description><![CDATA[4.索引子系统:&nbsp;类&nbsp;IndexManager&nbsp;用来实现这个子系统。清单8&nbsp;给出了这个类的源代码。&nbsp;<br/><br/>清单8：索引子系统的实现<br/>package&nbsp;sample.dw.paper.lucene.index;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.File;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.IOException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.Reader;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.analysis.Analyzer;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.analysis.standard.StandardAnalyzer;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.document.Document;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.document.Field;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.index.IndexWriter;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.store.Directory;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.store.FSDirectory;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;sample.dw.paper.lucene.util.HTMLDocParser;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;class&nbsp;is&nbsp;used&nbsp;to&nbsp;cr&#101;ate&nbsp;an&nbsp;index&nbsp;for&nbsp;HTML&nbsp;files&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;class&nbsp;IndexManager&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//the&nbsp;directory&nbsp;that&nbsp;stores&nbsp;HTML&nbsp;files&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;final&nbsp;String&nbsp;dataDir&nbsp;&nbsp;=&nbsp;&#34;c:\\dataDir&#34;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//the&nbsp;directory&nbsp;that&nbsp;is&nbsp;used&nbsp;to&nbsp;store&nbsp;a&nbsp;Lucene&nbsp;index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;final&nbsp;String&nbsp;indexDir&nbsp;=&nbsp;&#34;c:\\indexDir&#34;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;cr&#101;ate&nbsp;index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;boolean&nbsp;cr&#101;ateIndex()&nbsp;throws&nbsp;IOException{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(true&nbsp;==&nbsp;ifIndexExist()){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;dir&nbsp;=&nbsp;new&nbsp;File(dataDir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!dir.exists()){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File[]&nbsp;htmls&nbsp;=&nbsp;dir.listFiles();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory&nbsp;fsDirectory&nbsp;=&nbsp;FSDirectory.getDirectory(indexDir,&nbsp;true);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Analyzer&nbsp;&nbsp;analyzer&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;new&nbsp;StandardAnalyzer();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexWriter&nbsp;indexWriter&nbsp;=&nbsp;new&nbsp;IndexWriter(fsDirectory,&nbsp;analyzer,&nbsp;true);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;htmls.length;&nbsp;i++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;htmlPath&nbsp;=&nbsp;htmls[i].getAbsolutePath();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(htmlPath.endsWith(&#34;.html&#34;)&nbsp;||&nbsp;htmlPath.endsWith(&#34;.htm&#34;)){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addDocument(htmlPath,&nbsp;indexWriter);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexWriter.optimize();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexWriter.close();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Add&nbsp;one&nbsp;document&nbsp;to&nbsp;the&nbsp;Lucene&nbsp;index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;addDocument(String&nbsp;htmlPath,&nbsp;IndexWriter&nbsp;indexWriter){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTMLDocParser&nbsp;htmlParser&nbsp;=&nbsp;new&nbsp;HTMLDocParser(htmlPath);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;path&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;htmlParser.getPath();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;title&nbsp;&nbsp;&nbsp;=&nbsp;htmlParser.getTitle();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reader&nbsp;content&nbsp;=&nbsp;htmlParser.getContent();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Document&nbsp;document&nbsp;=&nbsp;new&nbsp;Document();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.add(new&nbsp;Field(&#34;path&#34;,path,Field.Store.YES,Field.Index.NO));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.add(new&nbsp;Field(&#34;title&#34;,title,Field.Store.YES,Field.Index.TOKENIZED));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.add(new&nbsp;Field(&#34;content&#34;,content));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexWriter.addDocument(document);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(IOException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;judge&nbsp;if&nbsp;the&nbsp;index&nbsp;exists&nbsp;already&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;boolean&nbsp;ifIndexExist(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;directory&nbsp;=&nbsp;new&nbsp;File(indexDir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(0&nbsp;&lt;&nbsp;directory.listFiles().length){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;String&nbsp;getDataDir(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;this.dataDir;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;String&nbsp;getIndexDir(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;this.indexDir;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>这个类包含两个私有属性，分别是&nbsp;dataDir&nbsp;和&nbsp;indexDir。dataDir&nbsp;代表存放等待进行索引的&nbsp;HTML&nbsp;页面的路径，indexDir&nbsp;代表了存放&nbsp;Lucene&nbsp;索引文件的路径。类&nbsp;IndexManager&nbsp;提供了三个方法，分别是&nbsp;cr&#101;ateIndex,&nbsp;addDocument&nbsp;和&nbsp;ifIndexExist。如果索引不存在的话，你可以使用方法&nbsp;cr&#101;ateIndex&nbsp;去创建一个新的索引，用方法&nbsp;addDocument&nbsp;去向一个索引上添加文档。在我们的场景中，一个文档就是一个&nbsp;HTML&nbsp;页面。方法&nbsp;addDocument&nbsp;会调用由类&nbsp;HTMLDocParser&nbsp;提供的方法对&nbsp;HTML&nbsp;文档进行解析。你可以使用最后一个方法&nbsp;ifIndexExist&nbsp;来判断&nbsp;Lucene&nbsp;的索引是否已经存在。&nbsp;<br/>现在我们来看一下放在包&nbsp;sample.dw.paper.lucene.util&nbsp;里面的类&nbsp;HTMLDocParser。这个类用来从&nbsp;HTML&nbsp;文件中提取出文本信息。这个类包含三个方法，分别是&nbsp;getContent，getTitle&nbsp;和&nbsp;getPath。第一个方法返回去除了&nbsp;HTML&nbsp;标记的文本内容，第二个方法返回&nbsp;HTML&nbsp;文件的标题，最后一个方法返回&nbsp;HTML&nbsp;文件的路径。清单9&nbsp;给出了这个类的源代码。&nbsp;<br/><br/>清单9：HTML&nbsp;解析器<br/>package&nbsp;sample.dw.paper.lucene.util;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.FileInputStream;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.FileNotFoundException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.IOException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.InputStream;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.InputStreamReader;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.Reader;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.UnsupportedEncodingException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.demo.html.HTMLParser;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;class&nbsp;HTMLDocParser&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;String&nbsp;htmlPath;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;HTMLParser&nbsp;htmlParser;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;HTMLDocParser(String&nbsp;htmlPath){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.htmlPath&nbsp;=&nbsp;htmlPath;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initHtmlParser();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;void&nbsp;initHtmlParser(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InputStream&nbsp;inputStream&nbsp;=&nbsp;null;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inputStream&nbsp;=&nbsp;new&nbsp;FileInputStream(htmlPath);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(FileNotFoundException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(null&nbsp;!=&nbsp;inputStream){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htmlParser&nbsp;=&nbsp;new&nbsp;HTMLParser(new&nbsp;InputStreamReader(inputStream,&nbsp;&#34;utf-8&#34;));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(UnsupportedEncodingException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;String&nbsp;getTitle(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(null&nbsp;!=&nbsp;htmlParser){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;htmlParser.getTitle();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(IOException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(InterruptedException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&#34;&#34;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;Reader&nbsp;getContent(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(null&nbsp;!=&nbsp;htmlParser){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;htmlParser.getReader();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(IOException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;null;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;String&nbsp;getPath(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;this.htmlPath;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=89</link>
			<title><![CDATA[用 Lucene 加速 Web 搜索应用程序的开发（三）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:06:51 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=89</guid>	
		<description><![CDATA[用&nbsp;Lucene&nbsp;加速&nbsp;Web&nbsp;搜索应用程序的开发（三）<br/>3.&nbsp;子系统的实现<br/>在分析了系统的架构设计之后，我们接下来看系统实现的详细信息。&nbsp;<br/>1.&#160;&#160;&#160;&#160;用户接口:&nbsp;这个子系统有一个名为&nbsp;search.jsp&nbsp;的&nbsp;JSP&nbsp;文件来实现，这个&nbsp;JSP&nbsp;页面包含两个部分。第一部分提供了一个用户接口去向&nbsp;Web&nbsp;应用程序服务器提交搜索请求，如图5所示。注意到这里的搜索请求发送到了一个名为&nbsp;SearchController&nbsp;的&nbsp;Servlet&nbsp;上面。Servlet&nbsp;的名字和具体实现的类的对应关系在&nbsp;web.xml&nbsp;里面指定。&nbsp;<br/><br/>图5：向Web服务器提交搜索请求<br/>&nbsp;这个JSP的第二部分负责显示搜索结果给用户，如图6所示：&nbsp;图6：显示搜索结果<br/>&nbsp;<br/>2.&#160;&#160;&#160;&#160;请求管理器:&nbsp;一个名为&nbsp;SearchController&nbsp;的&nbsp;servlet&nbsp;用来实现该子系统。清单６给出了这个类的源代码。&nbsp;<br/><br/>清单６：请求管理器的实现<br/>package&nbsp;sample.dw.paper.lucene.servlet;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.IOException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.util.List;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;javax.servlet.RequestDispatcher;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;javax.servlet.ServletException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;javax.servlet.http.HttpServlet;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;javax.servlet.http.HttpServletRequest;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;javax.servlet.http.HttpServletResponse;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;sample.dw.paper.lucene.search.SearchManager;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;servlet&nbsp;is&nbsp;used&nbsp;to&nbsp;deal&nbsp;with&nbsp;the&nbsp;search&nbsp;request&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;and&nbsp;return&nbsp;the&nbsp;search&nbsp;results&nbsp;to&nbsp;the&nbsp;client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;class&nbsp;SearchController&nbsp;extends&nbsp;HttpServlet{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;static&nbsp;final&nbsp;long&nbsp;serialVersionUID&nbsp;=&nbsp;1L;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;doPost(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;IOException,&nbsp;ServletException{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;searchWord&nbsp;=&nbsp;request.getParameter(&#34;searchWord&#34;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SearchManager&nbsp;searchManager&nbsp;=&nbsp;new&nbsp;SearchManager(searchWord);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&nbsp;searchResult&nbsp;=&nbsp;null;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;searchResult&nbsp;=&nbsp;searchManager.search();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RequestDispatcher&nbsp;dispatcher&nbsp;=&nbsp;request.getRequestDispatcher(&#34;search.jsp&#34;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;request.setAttribute(&#34;searchResult&#34;,searchResult);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dispatcher.forward(request,&nbsp;response);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;doGet(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;IOException,&nbsp;ServletException{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doPost(request,&nbsp;response);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>在清单6中，doPost&nbsp;方法从客户端获取搜索词并创建类&nbsp;SearchManager&nbsp;的一个实例，其中类&nbsp;SearchManager&nbsp;在搜索子系统中进行了定义。然后，SearchManager&nbsp;的方法&nbsp;search&nbsp;会被调用。最后搜索结果被返回到客户端。&nbsp;<br/>3.&#160;&#160;&#160;&#160;搜索子系统:&nbsp;在这个子系统中，我们定义了两个类：SearchManager&nbsp;和&nbsp;SearchResultBean。第一个类用来实现搜索功能，第二个类是个JavaBean，用来描述搜索结果的结构。清单7给出了类&nbsp;SearchManager&nbsp;的源代码。&nbsp;<br/><br/>清单7：搜索功能的实现<br/>package&nbsp;sample.dw.paper.lucene.search;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.io.IOException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.util.ArrayList;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;java.util.List;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.analysis.Analyzer;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.analysis.standard.StandardAnalyzer;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.queryParser.ParseException;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.queryParser.QueryParser;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.search.Hits;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.search.IndexSearcher;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;o&#114;g.apache.lucene.search.Query;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;sample.dw.paper.lucene.index.IndexManager;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;This&nbsp;class&nbsp;is&nbsp;used&nbsp;to&nbsp;search&nbsp;the&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Lucene&nbsp;index&nbsp;and&nbsp;return&nbsp;search&nbsp;results&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;class&nbsp;SearchManager&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;String&nbsp;searchWord;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;IndexManager&nbsp;indexManager;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;Analyzer&nbsp;analyzer;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;SearchManager(String&nbsp;searchWord){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.searchWord&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;searchWord;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.indexManager&nbsp;=&nbsp;&nbsp;new&nbsp;IndexManager();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.analyzer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;new&nbsp;StandardAnalyzer();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;do&nbsp;search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;List&nbsp;search(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&nbsp;searchResult&nbsp;=&nbsp;new&nbsp;ArrayList();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(false&nbsp;==&nbsp;indexManager.ifIndexExist()){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(false&nbsp;==&nbsp;indexManager.cr&#101;ateIndex()){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;searchResult;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(IOException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;searchResult;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;indexSearcher&nbsp;=&nbsp;null;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexSearcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(indexManager.getIndexDir());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}catch(IOException&nbsp;ioe){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ioe.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QueryParser&nbsp;queryParser&nbsp;=&nbsp;new&nbsp;QueryParser(&#34;content&#34;,analyzer);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Query&nbsp;query&nbsp;=&nbsp;null;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;queryParser.parse(searchWord);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(ParseException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(null&nbsp;!=&nbsp;query&nbsp;&gt;&gt;&nbsp;null&nbsp;!=&nbsp;indexSearcher){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;hits&nbsp;=&nbsp;indexSearcher.search(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;hits.length();&nbsp;i&nbsp;++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SearchResultBean&nbsp;resultBean&nbsp;=&nbsp;new&nbsp;SearchResultBean();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resultBean.setHtmlPath(hits.doc(i).get(&#34;path&#34;));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resultBean.setHtmlTitle(hits.doc(i).get(&#34;title&#34;));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;searchResult.add(resultBean);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(IOException&nbsp;e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;searchResult;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>在清单7中，注意到在这个类里面有三个私有属性。第一个是&nbsp;searchWord，代表了来自客户端的搜索词。第二个是&nbsp;indexManager，代表了在索引子系统中定义的类&nbsp;IndexManager&nbsp;的一个实例。第三个是&nbsp;analyzer，代表了用来解析搜索词的解析器。现在我们把注意力放在方法&nbsp;search&nbsp;上面。这个方法首先检查索引文件是否已经存在，如果已经存在，那么就在已经存在的索引上进行检索，如果不存在，那么首先调用类&nbsp;IndexManager&nbsp;提供的方法来创建索引，然后在新创建的索引上进行检索。搜索结果返回后，这个方法从搜索结果中提取出需要的属性并为每个搜索结果生成类&nbsp;SearchResultBean&nbsp;的一个实例。最后这些&nbsp;SearchResultBean&nbsp;的实例被放到一个列表里面并返回给请求管理器。<br/>在类&nbsp;SearchResultBean&nbsp;中，含有两个属性，分别是&nbsp;htmlPath&nbsp;和&nbsp;htmlTitle，以及这个两个属性的&nbsp;get&nbsp;和&nbsp;set&nbsp;方法。这也意味着我们的搜索结果包含两个属性：htmlPath&nbsp;和&nbsp;htmlTitle，其中&nbsp;htmlPath&nbsp;代表了&nbsp;HTML&nbsp;文件的路径，htmlTitle&nbsp;代表了&nbsp;HTML&nbsp;文件的标题。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=88</link>
			<title><![CDATA[用 Lucene 加速 Web 搜索应用程序的开发（二）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:05:14 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=88</guid>	
		<description><![CDATA[用&nbsp;Lucene&nbsp;加速&nbsp;Web&nbsp;搜索应用程序的开发（二）<br/>模糊查询<br/>Lucene&nbsp;提供的模糊查询基于编辑距离算法(Edit&nbsp;distance&nbsp;algorithm)。你可以在搜索词的尾部加上字符&nbsp;~&nbsp;来进行模糊查询。例如，查询语句&nbsp;“think~”&nbsp;返回所有包含和&nbsp;think&nbsp;类似的关键词的文档。清单&nbsp;4&nbsp;显示了如果利用&nbsp;Lucene&nbsp;的&nbsp;API&nbsp;进行模糊查询的代码。&nbsp;<br/><br/>清单4：实现模糊查询<br/>//Test&nbsp;fuzzy&nbsp;search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;testFuzzySearch(String&nbsp;indexDirectory)throws&nbsp;Exception{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory&nbsp;dir&nbsp;=&nbsp;FSDirectory.getDirectory(indexDirectory,false);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;indexSearcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(dir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String[]&nbsp;searchWords&nbsp;=&nbsp;{&#34;text&#34;,&nbsp;&#34;funny&#34;};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Query&nbsp;query;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;searchWords.length;&nbsp;i++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;new&nbsp;FuzzyQuery(new&nbsp;Term(&#34;title&#34;,searchWords[i]));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;results&nbsp;=&nbsp;indexSearcher.search(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(results.length()&nbsp;+&nbsp;&#34;search&nbsp;results&nbsp;for&nbsp;query&nbsp;&#34;&nbsp;+&nbsp;searchWords[i]);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>范围搜索(Range&nbsp;Search)<br/>范围搜索匹配某个域上的值在一定范围的文档。例如，查询&nbsp;“age:[18&nbsp;TO&nbsp;35]”&nbsp;返回所有&nbsp;age&nbsp;域上的值在&nbsp;18&nbsp;到&nbsp;35&nbsp;之间的文档。清单5显示了利用&nbsp;Lucene&nbsp;的&nbsp;API&nbsp;进行返回搜索的过程。&nbsp;<br/><br/>清单5：测试范围搜索<br/>//Test&nbsp;range&nbsp;search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;testRangeSearch(String&nbsp;indexDirectory)throws&nbsp;Exception{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory&nbsp;dir&nbsp;=&nbsp;FSDirectory.getDirectory(indexDirectory,false);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;indexSearcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(dir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Term&nbsp;begin&nbsp;=&nbsp;new&nbsp;Term(&#34;birthDay&#34;,&#34;20000101&#34;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Term&nbsp;end&nbsp;&nbsp;&nbsp;=&nbsp;new&nbsp;Term(&#34;birthDay&#34;,&#34;20060606&#34;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Query&nbsp;query&nbsp;=&nbsp;new&nbsp;RangeQuery(begin,end,true);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;results&nbsp;=&nbsp;indexSearcher.search(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(results.length()&nbsp;+&nbsp;&#34;search&nbsp;results&nbsp;is&nbsp;returned&#34;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>&nbsp;<br/>&nbsp;<br/>回页首<br/><br/><br/><br/>在&nbsp;Web&nbsp;应用程序中集成&nbsp;Lucene<br/>接下来我们开发一个&nbsp;Web&nbsp;应用程序利用&nbsp;Lucene&nbsp;来检索存放在文件服务器上的&nbsp;HTML&nbsp;文档。在开始之前，需要准备如下环境：<br/>1.&#160;&#160;&#160;&#160;Eclipse&nbsp;集成开发环境&nbsp;<br/>2.&#160;&#160;&#160;&#160;Tomcat&nbsp;5.0&nbsp;<br/>3.&#160;&#160;&#160;&#160;Lucene&nbsp;Library&nbsp;<br/>4.&#160;&#160;&#160;&#160;JDK&nbsp;1.5&nbsp;<br/>这个例子使用&nbsp;Eclipse&nbsp;进行&nbsp;Web&nbsp;应用程序的开发，最终这个&nbsp;Web&nbsp;应用程序跑在&nbsp;Tomcat&nbsp;5.0&nbsp;上面。在准备好开发所必需的环境之后，我们接下来进行&nbsp;Web&nbsp;应用程序的开发。&nbsp;<br/>1、创建一个动态&nbsp;Web&nbsp;项目<br/>1.&#160;&#160;&#160;&#160;在&nbsp;Eclipse&nbsp;里面，选择&nbsp;File&nbsp;&gt;&nbsp;New&nbsp;&gt;&nbsp;Project，然后再弹出的窗口中选择动态&nbsp;Web&nbsp;项目，如图二所示。&nbsp;<br/>图二：创建动态Web项目<br/>&nbsp;<br/>2.&#160;&#160;&#160;&#160;在创建好动态&nbsp;Web&nbsp;项目之后，你会看到创建好的项目的结构，如图三所示，项目的名称为&nbsp;sample.dw.paper.lucene。&nbsp;图三：动态&nbsp;Web&nbsp;项目的结构<br/>&nbsp;<br/>2.&nbsp;设计&nbsp;Web&nbsp;项目的架构<br/>在我们的设计中，把该系统分成如下四个子系统：<br/>1.&#160;&#160;&#160;&#160;用户接口:&nbsp;这个子系统提供用户界面使用户可以向&nbsp;Web&nbsp;应用程序服务器提交搜索请求，然后搜索结果通过用户接口来显示出来。我们用一个名为&nbsp;search.jsp&nbsp;的页面来实现该子系统。&nbsp;<br/>2.&#160;&#160;&#160;&#160;请求管理器:&nbsp;这个子系统管理从客户端发送过来的搜索请求并把搜索请求分发到搜索子系统中。最后搜索结果从搜索子系统返回并最终发送到用户接口子系统。我们使用一个&nbsp;Servlet&nbsp;来实现这个子系统。&nbsp;<br/>3.&#160;&#160;&#160;&#160;搜索子系统:&nbsp;这个子系统负责在索引文件上进行搜索并把搜索结构传递给请求管理器。我们使用&nbsp;Lucene&nbsp;提供的&nbsp;API&nbsp;来实现该子系统。&nbsp;<br/>4.&#160;&#160;&#160;&#160;索引子系统:&nbsp;这个子系统用来为&nbsp;HTML&nbsp;页面来创建索引。我们使用&nbsp;Lucene&nbsp;的&nbsp;API&nbsp;以及&nbsp;Lucene&nbsp;提供的一个&nbsp;HTML&nbsp;解析器来创建该子系统。&nbsp;<br/>图4&nbsp;显示了我们设计的详细信息，我们将用户接口子系统放到&nbsp;webContent&nbsp;目录下面。你会看到一个名为&nbsp;search.jsp&nbsp;的页面在这个文件夹里面。请求管理子系统在包&nbsp;sample.dw.paper.lucene.servlet&nbsp;下面，类&nbsp;SearchController&nbsp;负责功能的实现。搜索子系统放在包&nbsp;sample.dw.paper.lucene.search&nbsp;当中，它包含了两个类，SearchManager&nbsp;和&nbsp;SearchResultBean，第一个类用来实现搜索功能，第二个类用来描述搜索结果的结构。索引子系统放在包&nbsp;sample.dw.paper.lucene.index&nbsp;当中。类&nbsp;IndexManager&nbsp;负责为&nbsp;HTML&nbsp;文件创建索引。该子系统利用包&nbsp;sample.dw.paper.lucene.util&nbsp;里面的类&nbsp;HTMLDocParser&nbsp;提供的方法&nbsp;getTitle&nbsp;和&nbsp;getContent&nbsp;来对&nbsp;HTML&nbsp;页面进行解析。&nbsp;<br/><br/>图四：项目的架构设计<br/>&nbsp;<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=87</link>
			<title><![CDATA[用 Lucene 加速 Web 搜索应用程序的开发（一）]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,31 Mar 2010 13:04:03 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=87</guid>	
		<description><![CDATA[Lucene&nbsp;是基于&nbsp;Java&nbsp;的全文信息检索包，它目前是&nbsp;Apache&nbsp;Jakarta&nbsp;家族下面的一个开源项目。在这篇文章中，我们首先来看如何利用&nbsp;Lucene&nbsp;实现高级搜索功能，然后学习如何利用&nbsp;Lucene&nbsp;来创建一个健壮的&nbsp;Web&nbsp;搜索应用程序。<br/>在本篇文章中，你会学习到如何利用&nbsp;Lucene&nbsp;实现高级搜索功能以及如何利用&nbsp;Lucene&nbsp;来创建&nbsp;Web&nbsp;搜索应用程序。通过这些学习，你就可以利用&nbsp;Lucene&nbsp;来创建自己的搜索应用程序。<br/>架构概览<br/>通常一个&nbsp;Web&nbsp;搜索引擎的架构分为前端和后端两部分，就像图一中所示。在前端流程中，用户在搜索引擎提供的界面中输入要搜索的关键词，这里提到的用户界面一般是一个带有输入框的&nbsp;Web&nbsp;页面，然后应用程序将搜索的关键词解析成搜索引擎可以理解的形式，并在索引文件上进行搜索操作。在排序后，搜索引擎返回搜索结果给用户。在后端流程中，网络爬虫或者机器人从因特网上获取&nbsp;Web&nbsp;页面，然后索引子系统解析这些&nbsp;Web&nbsp;页面并存入索引文件中。如果你想利用&nbsp;Lucene&nbsp;来创建一个&nbsp;Web&nbsp;搜索应用程序，那么它的架构也和上面所描述的类似，就如图一中所示。<br/>Figure&nbsp;1.&nbsp;Web&nbsp;搜索引擎架构<br/>&nbsp;<br/>利用&nbsp;Lucene&nbsp;实现高级搜索<br/>Lucene&nbsp;支持多种形式的高级搜索，我们在这一部分中会进行探讨，然后我会使用&nbsp;Lucene&nbsp;的&nbsp;API&nbsp;来演示如何实现这些高级搜索功能。<br/>布尔操作符<br/>大多数的搜索引擎都会提供布尔操作符让用户可以组合查询，典型的布尔操作符有&nbsp;AND,&nbsp;o&#114;,&nbsp;NOT。Lucene&nbsp;支持&nbsp;5&nbsp;种布尔操作符，分别是&nbsp;AND,&nbsp;o&#114;,&nbsp;NOT,&nbsp;加(+),&nbsp;减(-)。接下来我会讲述每个操作符的用法。&nbsp;<br/>•&#160;&#160;&#160;&#160;o&#114;:&nbsp;如果你要搜索含有字符&nbsp;A&nbsp;或者&nbsp;B&nbsp;的文档，那么就需要使用&nbsp;o&#114;&nbsp;操作符。需要记住的是，如果你只是简单的用空格将两个关键词分割开，其实在搜索的时候搜索引擎会自动在两个关键词之间加上&nbsp;o&#114;&nbsp;操作符。例如，“Java&nbsp;o&#114;&nbsp;Lucene”&nbsp;和&nbsp;“Java&nbsp;Lucene”&nbsp;都是搜索含有&nbsp;Java&nbsp;或者含有&nbsp;Lucene&nbsp;的文档。&nbsp;<br/>•&#160;&#160;&#160;&#160;AND:&nbsp;如果你需要搜索包含一个以上关键词的文档，那么就需要使用&nbsp;AND&nbsp;操作符。例如，“Java&nbsp;AND&nbsp;Lucene”&nbsp;返回所有既包含&nbsp;Java&nbsp;又包含&nbsp;Lucene&nbsp;的文档。&nbsp;<br/>•&#160;&#160;&#160;&#160;NOT:&nbsp;Not&nbsp;操作符使得包含紧跟在&nbsp;NOT&nbsp;后面的关键词的文档不会被返回。例如，如果你想搜索所有含有&nbsp;Java&nbsp;但不含有&nbsp;Lucene&nbsp;的文档，你可以使用查询语句&nbsp;“Java&nbsp;NOT&nbsp;Lucene”。但是你不能只对一个搜索词使用这个操作符，比如，查询语句&nbsp;“NOT&nbsp;Java”&nbsp;不会返回任何结果。&nbsp;<br/>•&#160;&#160;&#160;&#160;加号（+）:&nbsp;这个操作符的作用和&nbsp;AND&nbsp;差不多，但它只对紧跟着它的一个搜索词起作用。例如，如果你想搜索一定包含&nbsp;Java，但不一定包含&nbsp;Lucene&nbsp;的文档，就可以使用查询语句“+Java&nbsp;Lucene”。&nbsp;<br/>•&#160;&#160;&#160;&#160;减号（-）:&nbsp;这个操作符的功能和&nbsp;NOT&nbsp;一样，查询语句&nbsp;“Java&nbsp;-Lucene”&nbsp;返回所有包含&nbsp;Java&nbsp;但不包含&nbsp;Lucene&nbsp;的文档。&nbsp;<br/>接下来我们看一下如何利用&nbsp;Lucene&nbsp;提供的&nbsp;API&nbsp;来实现布尔查询。清单1&nbsp;显示了如果利用布尔操作符进行查询的过程。<br/><br/>清单1：使用布尔操作符<br/>&nbsp;&nbsp;//Test&nbsp;boolean&nbsp;operator&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;testOperator(String&nbsp;indexDirectory)&nbsp;throws&nbsp;Exception{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory&nbsp;dir&nbsp;=&nbsp;FSDirectory.getDirectory(indexDirectory,false);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;indexSearcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(dir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String[]&nbsp;searchWords&nbsp;=&nbsp;{&#34;Java&nbsp;AND&nbsp;Lucene&#34;,&nbsp;&#34;Java&nbsp;NOT&nbsp;Lucene&#34;,&nbsp;&#34;Java&nbsp;o&#114;&nbsp;Lucene&#34;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;+Java&nbsp;+Lucene&#34;,&nbsp;&#34;+Java&nbsp;-Lucene&#34;};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Analyzer&nbsp;language&nbsp;=&nbsp;new&nbsp;StandardAnalyzer();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Query&nbsp;query;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;searchWords.length;&nbsp;i++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;QueryParser.parse(searchWords[i],&nbsp;&#34;title&#34;,&nbsp;language);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;results&nbsp;=&nbsp;indexSearcher.search(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(results.length()&nbsp;+&nbsp;&#34;search&nbsp;results&nbsp;for&nbsp;query&nbsp;&#34;&nbsp;+&nbsp;searchWords[i]);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>域搜索(Field&nbsp;Search)<br/>Lucene&nbsp;支持域搜索，你可以指定一次查询是在哪些域(Field)上进行。例如，如果索引的文档包含两个域，Title&nbsp;和&nbsp;Content，你就可以使用查询&nbsp;“Title:&nbsp;Lucene&nbsp;AND&nbsp;Content:&nbsp;Java”&nbsp;来返回所有在&nbsp;Title&nbsp;域上包含&nbsp;Lucene&nbsp;并且在&nbsp;Content&nbsp;域上包含&nbsp;Java&nbsp;的文档。清单&nbsp;2&nbsp;显示了如何利用&nbsp;Lucene&nbsp;的&nbsp;API&nbsp;来实现域搜索。&nbsp;<br/><br/>清单2：实现域搜索<br/>//Test&nbsp;field&nbsp;search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;testFieldSearch(String&nbsp;indexDirectory)&nbsp;throws&nbsp;Exception{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory&nbsp;dir&nbsp;=&nbsp;FSDirectory.getDirectory(indexDirectory,false);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;indexSearcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(dir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;searchWords&nbsp;=&nbsp;&#34;title:Lucene&nbsp;AND&nbsp;content:Java&#34;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Analyzer&nbsp;language&nbsp;=&nbsp;new&nbsp;StandardAnalyzer();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Query&nbsp;query&nbsp;=&nbsp;QueryParser.parse(searchWords,&nbsp;&#34;title&#34;,&nbsp;language);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;results&nbsp;=&nbsp;indexSearcher.search(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(results.length()&nbsp;+&nbsp;&#34;search&nbsp;results&nbsp;for&nbsp;query&nbsp;&#34;&nbsp;+&nbsp;searchWords);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/>通配符搜索(Wildcard&nbsp;Search)<br/>Lucene&nbsp;支持两种通配符：问号（？）和星号（*）。你可以使用问号（？）来进行单字符的通配符查询，或者利用星号（*）进行多字符的通配符查询。例如，如果你想搜索&nbsp;tiny&nbsp;或者&nbsp;tony，你就可以使用查询语句&nbsp;“t?ny”；如果你想查询&nbsp;Teach,&nbsp;Teacher&nbsp;和&nbsp;Teaching，你就可以使用查询语句&nbsp;“Teach*”。清单3&nbsp;显示了通配符查询的过程。&nbsp;<br/><br/>清单3：进行通配符查询<br/>//Test&nbsp;wildcard&nbsp;search&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;void&nbsp;testWildcardSearch(String&nbsp;indexDirectory)throws&nbsp;Exception{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directory&nbsp;dir&nbsp;=&nbsp;FSDirectory.getDirectory(indexDirectory,false);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;indexSearcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(dir);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String[]&nbsp;searchWords&nbsp;=&nbsp;{&#34;tex*&#34;,&nbsp;&#34;tex?&#34;,&nbsp;&#34;?ex*&#34;};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Query&nbsp;query;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;searchWords.length;&nbsp;i++){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;new&nbsp;WildcardQuery(new&nbsp;Term(&#34;title&#34;,searchWords[i]));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;results&nbsp;=&nbsp;indexSearcher.search(query);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(results.length()&nbsp;+&nbsp;&#34;search&nbsp;results&nbsp;for&nbsp;query&nbsp;&#34;&nbsp;+&nbsp;searchWords[i]);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/><br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=86</link>
			<title><![CDATA[浅析网络舆情的特点和应对方法]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,30 Mar 2010 17:36:11 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=86</guid>	
		<description><![CDATA[作者：技术科<br/>随着信息技术特别是互联网的飞速发展，社会舆论特别是网络舆情对司法工作包括检察工作的影响力明显加大。截至2009年6月底，我国3.38亿网民中，有78.7％经常上网浏览新闻，在网络应用中排名第二位。显然，三亿多的中国网民，已经成为一个不可小觑的舆论监督力量。基层检察院处在执法办案第一线，是服务和谐社会建设的中坚力量，因对某些案件介入不及时，处置措施不当等原因，被网络关注，可能引发网络舆情危机。如何研判和应对网络舆情，及时有效地正确引导，消除网络舆情危机对检察机关的负面影响，在网络监督下提高检察机关执法公信力，是基层检察机关必须深入研究、正确对待的重要课题。<br/>一&nbsp;&nbsp;网络舆情的现状<br/>网络舆情是指在互联网背景之下，众多网民对于社会（现实社会、虚拟社会）各种现象、问题所表达的信念、态度、意见和情绪表现的总和，或简言之为网络舆论和民情。<br/>2009年1月，《人民日报》与人民网联合进行网上调查，参与调查的网民有87.9%非常关注网络监督，当遇到社会不良现象时，93.3%的网民选择网络曝光。据此，《人民日报》评论指出，网络监督已经成为畅达民意、维护权益、鞭挞腐败的便捷而有效的手段。如“南京市江宁区房管局长抽天价烟”、“云南躲猫猫”事件、“湖北邓玉娇事件”&nbsp;、“贵州瓮安事件”，事件发生后，短时间内网民意见铺天盖地，大有一发不可收拾的趋势。这些都对司法检察机关办理个案形成了很大的网络监督压力，有的甚至成为促使相关部门下决心研究解决类似问题的契机和推手。<br/>二&nbsp;&nbsp;网络舆情的特点<br/>一是突发性：由于借助网络平台传播信息简单直接且身份隐蔽，网民能够快速、大胆地发表意见，呼唤声援,在短时间内形成一种力量,以期引起社会和政府的重视。因此网络舆情的形成往往非常迅速，事先没有征兆。一个热点事件的存在加上一种情绪化的意见就能形成星火燎原之势。<br/>二是破坏性：检察机关网络舆情危机往往会引发社会大众与检察机关、执法人员在观点甚至行动上的剧烈冲突。<br/>三是紧迫性：检察机关必须对即将或者已经发生的舆情危机迅速做出正确的反应，防止事态的扩大，减少损失。<br/>而目前,&nbsp;我国检察机关在应对网络舆情危机能力方面还显得比较薄弱。具体来说主要存在以下二个问题：一个是认识不到位，观念落后。一些基层检察院对网络舆情的重要性认识不足，对网络舆情不关注，特别是对涉及本机关和当地党委政府形象的舆情不能引起应有的重视，认为网络舆情与自己无关，错误地认为虚拟的东西不值得关注；二是缺乏处置预案，一旦发生舆情束手无策。有的基层检察院对网络舆情工作缺乏前瞻性和预见性，对可能引发涉法、涉检信访的群体性事件、苗头性问题缺乏政治敏感性，对如何处置突发性重大事件没有制定处置预案，一旦发生网络舆情危急情形，不知如何下手，难以应对，不能及时地引导和有效控制事态发展，负面影响难以及时消除。<br/>三&nbsp;&nbsp;检察机关应对网络舆情的几点建议<br/>新时期，检察机关如何应对网络舆情危机，及时掌握社会舆情动态，不断增强引导舆论的本领，牢牢把握政法舆论工作的主动权，可以从以下几个方面入手：<br/>（一）从自身下手，要在检务公开上下功夫。<br/>一是加大公开力度。认真执行最高人民检察院《关于进一步深化人民检察院“检务公开”的意见》，凡是与检察职权相关而又不涉及国家秘密、商业秘密和个人隐私的事项都应当公开。<br/>二是创新公开形式。借鉴其他单位的先进经验，多形式接受人民群众来访，邀请人民群众参观，主动公开检察机关工作职责、办案流程等不涉密的事项和程序。<br/>三是丰富公开载体。突出抓好检察门户网站建设，把检察门户网站建设成为征求意见、网上受理、在线交流、咨询问答、网上展览等多功能有序整合的统一平台，切实加强检察机关、检察干警与人民群众的互动交流，进一步畅通检察机关接受监督的渠道，并引导群众正确认识当前社会矛盾，理性合法表达诉求，自觉维护社会主义法制权威，不断拓宽人民群众了解检察工作的渠道，最大限度地保障人民群众对检察工作的知情权、参与权、表达权、监督权。<br/>（二）增强检察机关工作人员的舆情意识，树立正确的舆情观念。<br/>长期以来，在部分检察机关工作人员的观念中存在一个误区，认为与媒体打交道是宣传部门的事，与己无关。对一些突发事件反应迟缓、被动应付、危机公关意识缺位。由此，往往造成恶性循环，引起更为严重的后果。<br/>要有正确的舆情观念，包括堵不如疏，盖不如开，被动不如主动，事后救火不如事前防火。对于舆情危机事件，要更新观念，争分夺秒抢发突发事件新闻稿。先上网，后见报。先简报，后详报。占领网上发言主动权和主导权。<br/>（三）加强正面引导，平息舆论风波。<br/>面对网络舆情，不可束手无策，最要紧的是直接面对网民，把已经了解和可以确定的事实真相、正在采取的措施、有关部门和责任人员的态度予以公布，只有让真相站出来，占领舆论的制高点，才能防止流言蜚语，变被动为主动。对重大舆情要适时跟踪，及时公开事件调查、处置情况，不给滥加猜测留有空间。应当允许社会大众对事件的进展和查处结果进行监督，对舆情进行疏导而不是封锁，一味地回避只会让小道消息、社会谣言占据信息传播的主渠道。对舆情及网络事件应当更宽容，允许民众以一种更主动的方式参与到司法监督中来，反而有利于促进问题的实质性解决。<br/>（四）制定详细而周密的网络舆情危机阶梯预案。<br/>详细而周密的预案，保证了在危机发生时有条不紊，获得最大程度的主动权。可以借鉴《国家突发公共事件总体应急预案》，将危机分为四级，即Ⅰ级（特别重大）、Ⅱ级（重大）、Ⅲ级（较大）和Ⅳ级（一般）。每一等级都由不同级别、不同范围的力量参与到危机应对中，根据危机的等级，调动与之对应的资源和力量进行危机化解。<br/>（五）要在总结经验教训上下功夫。<br/>要注意及时总结经验、汲取教训，不断提升检察机关应对网络舆情、接受网络监督、提高执法公信力的能力和水平。网络时代带给检察机关的，是无孔不入的监督，只有严格执法，让群众满意，才不会产生舆情危机。<br/>网络舆情是新时期的新问题，我们一定要牢固树立理性、配合、文明、规范执法的理念，进一步深化检务公开，加强涉检信访的源头治理和妥善化解，切实提高执法公信力。要引导人们正确认识当前社会矛盾，理性合法表达诉求，自觉维护社会主义法制权威，切实维护社会和谐稳定。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=85</link>
			<title><![CDATA[德阳公安信息化：成就“千里眼”与“顺风耳”]]></title>
			<author>jaddy0302@126.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,30 Mar 2010 17:31:19 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=85</guid>	
		<description><![CDATA[作者：佚名<br/>面对国际国内的新格局，科技发展的大趋势，决策者们用历史的眼光审视着公安机关的发展方向，谋划着这场意义深远的现代警务战略布局，提出了科技强警战略。<br/>　　当计算机、网络信息技术等被广泛运用之时，人类社会步入信息时代。在信息化的大潮中，传统警务面临着向现代警务转变的前所未有的新挑战。<br/>　　如何使每一位公安民警都成为拥有“千里眼”和“顺风耳”等特殊功能的“天兵天将”呢?<br/>　　面对国际国内的新格局，科技发展的大趋势，决策者们用历史的眼光审视着公安机关的发展方向，谋划着这场意义深远的现代警务战略布局，提出了科技强警战略：公安工作由数量规模型向质量效能型转变，由人才密集型向科技密集型转变。以公安信息化为标志的强警&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;工程全面展开。<br/>　　德阳市公安机关按照公安部、省公安厅推进“三项建设”的战略部署，坚持以科学发展观为指导，把信息化作为推动公安工作全面发展进步的强大引擎，着眼现代警务机制构建，以攻坚克难的勇气、超常规的力度与举措，大力实施德阳公安信息化建设“1373”工程，推动全市公安信息化建设的整体跨越发展，促使全市公安系统打击防范能力明显提升，人民群众安全感明显提升，党委、政府对公安机关的满意度明显提升。<br/>　　信息化成为德阳公安“千里眼”和“顺风耳”<br/>　　“没有公安机关的信息化建设，震惊全省、全国的‘1•10’持枪杀人案就不可能在短时间内成功告破。”12月8日，说起信息化建设提升公安机关侦查办案、治安防控能力的作用时，德阳市副市长、公安局长陈正权赞不绝口。<br/>　　今年1月10日14时许，广汉市雒城镇一露天茶铺发生一起3死2伤的持枪杀人案。受害人陈富伟等3人被3名男子开枪打死，2人被流弹击伤。案发后，中央、省、市各级领导高度重视，有关领导相继作出重要批示，要求尽快破案，消除影响。<br/>　　专案组经缜密侦查，成功抓获1名直接实施枪击犯罪的嫌疑人和7名涉案嫌疑人，缴获手枪4支(其中作案枪支3支)、子弹40发。<br/>　　陈正权介绍说，该案的成功告破，信息化建设居功至伟。<br/>　　充分、合理利用公安信息系统，极大提高了工作效率。专案组通过网上比对、串并案分析、网上协作、网上协查，在短时间内完成了对数百人身份的识别和对数十名重点人员的排查和对上千条案件线索的筛查，不仅节省了大量的人力、物力，而且为案件的侦破赢得了时间;<br/>　　公安信息化建设延伸到社会单位是突破该案的关键。广汉市公安局建成的社会成员单位内部“小天网”工程，与“天网”工程形成了互为衔接、互相补充的监控格局，极大拓展了监控范围，正是由于这些基础设施的完善，为该案的侦破提供了极大的帮助。专案组通过对“天网”和“小天网”的分析，发现其中一名犯罪嫌疑人，据此线索，逐渐理清案件脉络，将该案的策划者、组织者、实施者以及涉嫌包庇的人员一一查出，并相继抓获。<br/>　　公安信息系统为追逃提供了极大便利。专案组利用信息系统，成功获取犯罪嫌疑人详细信息和活动轨迹，成功将枪手张东华锁定在重庆，并在重庆将其抓获。<br/>　　陈正权介绍，一年来，该市利用网上情报信息直接破获刑事案件1354起，占破案总数的17.8%;协助破获刑事案件1613起，占破案总数的21.2%。这其中包括震惊全国的大案、要案，运用经侦信息系统，破获西部地区首例印制假币1100多万元的特大犯罪案件，包括部督逃犯吴小辉在内的9名犯罪嫌疑人悉数落网;运用禁毒信息系统，侦破“1•3”特大制造冰毒案，缴获冰毒1054.2余公斤、麻黄草粉3200公斤、用于制造冰毒的麻黄草10多吨以及汽车9辆、毒资66万多元，抓获犯罪嫌疑人22名。运用禁毒信息系统，抓获了公安部挂牌督办、涉案冰毒达115公斤的“9•9”特大贩毒案主犯玉罕丽、邬富安。运用刑侦信息系统，破获百万电信诈骗案。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=84</link>
			<title><![CDATA[lucene.net系列三]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,10 Nov 2008 14:44:10 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=84</guid>	
		<description><![CDATA[<strong>--- index 中</strong><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">本文将进一步讨论有关</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><a title="" href="http://www.baidu.com/s?wd=lucene&amp;tn=cnidc8&amp;bar=">lucene</a><a title="介绍.NET相关技术知识" href="http://www.baidu.com/s?wd=.NET&amp;tn=cnidc8&amp;bar=">.NET</a></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">建立<a title="介绍搜索引擎相关技术知识" href="http://www.baidu.com/s?wd=%CB%F7%D2%FD&amp;tn=cnidc8&amp;bar=">索引</a>的问题</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">主要包含以下主题</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:<br />1.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">索引的权重</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br />2.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">利用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexWriter </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">属性对建立索引进行高级管理</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br />3.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">利用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">充分发挥内存的优势</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br />4.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">利用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">并行建立索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br />5.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">控制索引内容的长度</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br />6.Optimize </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt"><a title="介绍优化相关技术,技巧,知识" href="http://www.baidu.com/s?wd=%D3%C5%BB%AF&amp;tn=cnidc8&amp;bar=">优化</a>的是什么</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">?</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><a href="http://www.alphatom.com/component/option,com_docman/task,cat_view/gid,74/lang,/?mosmsg=You+are+trying+to+access+from+a+non-authorized+domain.+%28%29" target="_blank"><span lang="EN-US" style="FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana"><span lang="EN-US"><font color="#008000">源代码下载</font></span></span></a></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">本文将进一步讨论有关</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene.net</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">建立索引的问题</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">索引的权重</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span></b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">根据文档的重要性的不同</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">显然对于某些文档你希望提高权重以便将来搜索的时候</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">更符合你想要的结果</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">. </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">下面的代码演示了如何提高符合某些条件的文档的权重</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如对公司内很多的邮件做了索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">你当然希望主要查看和公司有关的邮件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而不是员工的个人邮件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这点根据邮件的地址就可以做出判断比如包含</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">@alphatom.com</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的就是公司邮件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">@gmail.com</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">等等就是私人邮件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">如何提高相应邮件的权重</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">? </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">代码如下</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; public static&nbsp; String COMPANY_DOMAIN = &quot;alphatom.com&quot;;</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; Document doc = new Document();</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; String senderEmail = GetSenderEmail();</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; String senderName = getSenderName();</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; String subject = GetSubject();</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; String body = GetBody();</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Keyword(&quot;senderEmail&rdquo;, senderEmail));</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Text(&quot;senderName&quot;, senderName));</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Text(&quot;subject&quot;, subject));</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.UnStored(&quot;body&quot;, body));</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; if (GetSenderDomain().EndsWith(COMPANY_DOMAIN))&nbsp;</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;//</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">如果是公司邮件</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">提高权重</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">默认权重是</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">1.0</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.SetBoost(1.5);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">如果是私人邮件</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">降低权重</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">.</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.SetBoost(0.1);</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; writer.AddDocument(doc);</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">不仅如此你还可以对</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Field</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">也设置权重</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">.</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">比如你对邮件的主题更感兴趣</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">.</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">就可以提高它的权重</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">.&nbsp;&nbsp;&nbsp; </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Field senderNameField = Field.Text(&quot;senderName&quot;, senderName);</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; Field subjectField = Field.Text(&quot;subject&quot;, subject);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; subjectField.SetBoost(1.2);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">lucene</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">搜索的时候会对符合条件的文档按匹配的程度打分</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">这点就和</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">google</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">的</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">PageRank</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">有点类似</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">, </span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">而</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">SetBoost</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">中的</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Boost</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">就是其中的一个因素</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">当然还有其他的因素</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">.</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">这要放到搜索里再说</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">. </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">利用</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexWriter </span></b><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">变量对建立索引进行高级管理</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span></b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在建立索引的时候对性能影响最大的地方就是在将索引写入文件的时候</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">, </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所以在具体应用的时候就需要对此加以控制</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">在建立索引的时候对性能影响最大的地方就是在将索引写入文件的时候所以在具体应用的时候就需要对此加以控制</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> </span></p>
<table style="mso-padding-alt: 0cm 0cm 0cm 0cm; mso-cellspacing: 0cm" cellspacing="0" cellpadding="0" border="1">
    <tbody>
        <tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 86.25pt; PADDING-TOP: 0cm" width="115">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">IndexWriter</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">属性</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp; </span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 81pt; PADDING-TOP: 0cm" width="108">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">默认值</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"></span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 225pt; PADDING-TOP: 0cm" width="300">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">描述</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"></span></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 1">
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 86.25pt; PADDING-TOP: 0cm" width="115">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">MergeFactory</span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 81pt; PADDING-TOP: 0cm" width="108">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">10</span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 225pt; PADDING-TOP: 0cm" width="300">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">控制</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">segment</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">合并的频率和大小</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"></span></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 2">
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 86.25pt; PADDING-TOP: 0cm" width="115">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">MaxMergeDocs</span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 81pt; PADDING-TOP: 0cm" width="108">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Int32.MaxValue</span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 225pt; PADDING-TOP: 0cm" width="300">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">限制每个</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">segment</span><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">中包含的文档数</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"></span></p>
            </td>
        </tr>
        <tr style="mso-yfti-irow: 3; mso-yfti-lastrow: yes">
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 86.25pt; PADDING-TOP: 0cm" width="115">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">MinMergeDocs</span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 81pt; PADDING-TOP: 0cm" width="108">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">10</span></p>
            </td>
            <td style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; WIDTH: 225pt; PADDING-TOP: 0cm" width="300">
            <p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">当内存中的文档达到多少的时候再写入</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">segment</span></p>
            </td>
        </tr>
    </tbody>
</table>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">默认情况是每加入</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">10</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">份文档就从内存往</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">index</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">文件写入并生成一个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segement,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">然后每</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">10</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">就合并成一个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">通过</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MergeFactory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这个变量就可以对此进行控制</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">. </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MaxMergeDocs</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">用于控制一个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">文件中最多包含的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">数</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如限制为</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">100</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的话</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">即使当前有</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">10</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">也不会合并</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">因为合并后的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segmnet</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">将包含</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1000</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">个文档</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">超过了限制</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MinMergeDocs</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">用于确定一个当内存中文档达到多少的时候才写入文件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">该项对</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的数量和大小不会有什么影响</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">它仅仅影响内存的使用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">进一步影响写索引的效率</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">为了生动的体现这些变量对性能的影响</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">用一个小程序对此做了说明</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">. </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这里有点不可思议</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.Lucene in Action</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">书上的结果比我用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">dotLucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">做的结果快了近千倍</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这里给出书中用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的数据</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">希望大家比较一下看看是不是我的问题</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene in Action</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">书中的数据</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">% <a title="" href="http://www.baidu.com/s?wd=java&amp;tn=cnidc8&amp;bar=">java</a> lia.indexing.IndexTuningDemo 100000 10 9999999 10</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Merge factor: 10</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Max merge docs: 9999999</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Min merge docs: 10</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Time: 74136 ms</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">% java lia.indexing.IndexTuningDemo 100000 100 9999999 10</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Merge factor: 100</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Max merge docs: 9999999</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Min merge docs: 10</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Time: 68307 ms</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">我的数据</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">: 336684128 ms</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">可以看出</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MinMergeDocs(</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">主要用于控制内存</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">)</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MergeFactory(</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">控制合并的次数和合并后的大小</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">) </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">对建立索引有显著的影响</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">但是并不是</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MergeFactory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">越大越好</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">因为如果一个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的文档<span>数很多</span>的话</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在搜索的时候必然也会影响效率</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所以这里</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MergeFactory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的取值是一个需要平衡的问题</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MinMergeDocs</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">主要受限于内存</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">利用</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span></b><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">充分发挥内存的优势</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">从上面来看充分利用内存的<a title="" href="http://www.baidu.com/s?wd=%BF%D5%BC%E4&amp;tn=cnidc8&amp;bar=">空间</a></span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">减少读写文件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">写入</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">index)</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的次数是优化建立索引的重要方法</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">其实在</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中提供了更强大的方法来利用内存建立索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">使用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">来替代</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">FSDirectory. </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这时所有的索引都将建立在内存当中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这种方法对于数据量小的搜索业务很有帮助</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">同时可以使用它来进行一些小的测试</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">避免在测试时频繁建立删除索引文件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在实际应用中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">FSDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">协作可以更好的利用内存来优化建立索引的时间</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">具体方法如下</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">建立一个使用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">FSDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexWriter</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">2 .</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">建立一个使用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexWriter </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">3 </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">把</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">添加到</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">4 </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">当达到某种条件将</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">写入</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">FSDirectory.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">5 </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">重复第三步</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">示意代码</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:<br />&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;<span>private</span> FSDirectory fsDir = FSDirectory.GetDirectory(&quot;index&quot;,true);</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp; </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<span>private</span> RAMDirectory ramDir = new RAMDirectory();</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private IndexWriter fsWriter = IndexWriter(fsDir,new SimpleAnalyzer(), true);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private IndexWriter ramWriter = new IndexWriter(ramDir,new SimpleAnalyzer(), true);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (there are documents to index) </span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ramWriter.addDocument(doc);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (condition for flushing memory to disk has been met) </span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fsWriter.AddIndexes(Directory[]{ramDir}) ;</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ramWriter.Close();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //why not support flush?</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ramWriter =new IndexWriter(ramDir,new SimpleAnalyzer(),true);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; } </span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这里的条件完全由用户控制</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而不是</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">FSDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">采用对</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">计数的方式控制何时写入文件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">相比之下有更大的自由性</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">更能提升性能</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">利用</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span></b><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">并行建立索引</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">RAMDirectory</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">还提供了使用多线程来建立索引的可能性</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">下面这副<span>图很好</span>的说明了这一点</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp; </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">甚至你可以在一个高速的网络里使用多台计算机来同时建立索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">就像下面这种图所示</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">虽然有关并行同步的问题需要你自己进行处理</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">不过通过这种方式可以大大提高对大量数据建立索引的能力</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><b><span style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">控制索引内容的长度</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">.</span></b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在我的一篇</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><a href="http://www.alphatom.com/content/view/114/1/" target="_blank"><span lang="EN-US" style="FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana"><span lang="EN-US"><font color="#008000">速递</font></span></span></a></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">介绍过</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Google Desktop Search</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">只能搜索到文本中第</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">5000</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">个字的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">也就是</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">google</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在建立索引的时候只考虑前</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">5000</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">个字</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中同样也有这个配置功能</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">对一份文本建立索引时默认的索引长度是</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">10,000. </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">你可以通过</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexWriter </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">MaxFieldLength</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">属性对此加以修改</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">还是用一个例子说明问题</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> [Test]</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; public void FieldSize()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; // AddDocuments </span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"> GetHitCount</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">都是自定义的方法</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">详见源代码</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddDocuments(dir, 10);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">第一个参数是目录</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">第二个配置是索引的长度</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(1, GetHitCount(&quot;contents&quot;, &quot;bridges&quot;))</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">原文档的</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">contents</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">为</span><span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&rdquo;</span></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">Amsterdam has lots of bridges<span>&rdquo;</span></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">当索引长度为</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">10</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">个字时能找到</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">bridge</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddDocuments(dir, 1);</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(0, GetHitCount(&quot;contents&quot;, &quot;bridges&quot;));</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">当索引长度限制为</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">1</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">个字时就无法发现第</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">5</span><span style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-hansi-font-family: Verdana; mso-font-kerning: 0pt">个字</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">bridges</span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><br /></span><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366c0; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp; }</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">对索引内容限长往往是处于效率和空间大小的考虑</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">能够对此进行配置是建立索引必备的一个功能</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Optimize </span></b><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">优化的是什么</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">?</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在以前的例子里</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">你可能已经多次见过</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">writer.Optimize()</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这段代码</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.Optimize</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">到底做了什么</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">?</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">让你吃惊的是这里的优化对于建立索引不仅没有起到加速的作用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">反而是延长了建立索引的时间</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">为什么</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">?</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">因为这里的优化不是为建立索引做的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而是为<span>搜索做</span>的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">之前我们提到</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">默认每遇到</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">10</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">就合并一次</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">尽管如此在索引完成后仍然会留下几个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segmnets,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">6,7.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Optimize</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的过程就是要减少剩下的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Segment</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的数量</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">尽量让它们处于一个文件中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">它的过程很简单</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">就是新建一个空的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Segmnet,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">然后把原来的几个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segmnet</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">全合并到这一个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segmnet</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在此过程中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">你的硬盘空间会变大</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">因为同时存在两份一样大小的索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">不过在优化完成后</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">会自动将原来的多份</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Segments</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">删除</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">只保留最后生成的一份包含原来所有索引的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segment.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">尽量减少</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">segments</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的个数主要是为了增加查询的效率</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">假设你有一个</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Server,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">同时有很多的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Client</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">建立了各自不同的索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">如果此时搜索</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">那么必然要同时打开很多的索引文件</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这样显然会受到很大的限制</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">对性能产生影响</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">当然也不是随时做</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Optimize</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">就好</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">如前所述做优化时要花费更多的时间和空间</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而且在做优化的时候是不能进行查询的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所以索引建立的后期</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">并且索引的内容不会再发生太多的变化的时候做优化是一个比较好的时段</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=83</link>
			<title><![CDATA[lucene.net系列二]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,10 Nov 2008 14:29:07 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=83</guid>	
		<description><![CDATA[<strong><font face="Verdana" color="#45739c">index </font></strong><span><strong>上</strong>一详细介绍了有关</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">lucene.NET</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">索引添加删除更新的详细内容</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">并给出了所有的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">TestCase</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">供学习参考</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">建立</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Index</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的过程</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">抽取文本</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp; </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如将</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">PDF</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">以及</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Word</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中的内容以纯文本的形式提取出来</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所支持的类型主要为</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">String,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">为了方便同时也支持</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Date </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">以及</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Reader.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">其实如果使用这两个类型</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">会自动进行类型转换</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">文本分析</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp; Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">将针对所给的文本进行一些最基本的分析</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">并从中去除一些不必要的信息</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如一些常用字</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">a ,an, the </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">等等</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">如果搜索的时候不在乎字母的大小写</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">, </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">又可以去掉一些不必要的信息</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">总而言之你可以把这个过程想象成一个文本的过滤器</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所有的文本内容通过分析</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">, </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">将过滤掉一些内容</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">剩下最有用的信息</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">写入</span></b><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">index.</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">google</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">等常用的索引技术一样</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在写</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">index</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的时候都是采用的倒排索引技术</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(inverted index.) </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">简而言之</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">就是通过某种方法</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">类似</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">hash</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">表</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">?)</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">将常见的</span><span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&rdquo;</span></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">一篇文档中含有哪些词</span><span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&rdquo;</span></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这个问题转成</span><span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&rdquo;</span></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">哪篇文档中有这些词</span><span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&rdquo;</span></span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">. </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">而各个搜索引擎的索引机制的不同主要在于如何为这张倒排表添加更准确的描述</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">google</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">有名的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">PageRank</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">因素</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">当然也有自己的技术</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">希望在以后的文章中能为大家加以介绍</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在上一篇文章中</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">使用了最基本的建立索引的方法</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在这里将对某些问题加以详细的讨论</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1. </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">添加</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">至索引</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">上次添加的每份文档的信息是一样的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">都是文档的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">filename</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">contents.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">doc.Add(Field.Keyword(&quot;filename&quot;, file.FullName));<br />doc.Add(Field.Text(&quot;contents&quot;, new StreamReader(file.FullName)));</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中对每个文档的描述是可以不同的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">比如</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">两份文档都是描述一个人</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">其中一个添加的是</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">name, age </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">另一个添加的是</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">id, sex ,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这种不规则的文档描述在</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">中是允许的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.<br /></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">还有一点</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">支持对</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Field</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">进行</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Append , </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">如下</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">:</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">string baseWord = &quot;fast&quot;;<br />string synonyms[] = String {&quot;quick&quot;, &quot;rapid&quot;, &quot;speedy&quot;};<br />Document doc = new Document();<br />doc.Add(Field.Text(&quot;word&quot;, baseWord));<br />for (int i = 0; i &lt; synonyms.length; i++) <br />&nbsp;&nbsp;&nbsp; doc.Add(Field.Text(&quot;word&quot;, synonyms[i]));</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这点纯粹是为了方便用户的使用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">在内部</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">自动做了转化</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">效果和将它们拼接好再存是一样</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">2. </span></b><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">删除索引中的文档</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这一点</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所采取的方式比较怪</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">它使用</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexReader</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">来对要删除的项进行标记</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">然后在</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Reader Close</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">的时候一起删除</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.<br /></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这里简要介绍几个方法</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">[TestFixture]<br />public class DocumentDeleteTest : BaseIndexingTestCase&nbsp;&nbsp; // BaseIndexingTestCase</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">中的</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">SetUp</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">方法</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">建立了索引其中加入了两个</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document<br />{<br />&nbsp;&nbsp;&nbsp; [Test]<br />&nbsp;&nbsp;&nbsp; public void testDeleteBeforeIndexMerge()<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexReader reader = IndexReader.Open(dir);&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">当前索引中有两个</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(2, reader.MaxDoc());&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">文档从</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">0</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">开始计数</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,MaxDoc</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">表示下一个文档的序号</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(2, reader.NumDocs());&nbsp; //NumDocs</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">表示当前索引中文档的个数</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Delete(1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">对标号为</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">的文档标记为待删除</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">逻辑删除</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(reader.IsDeleted(1));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">检测某个序号的文档是否被标记删除</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsTrue(reader.HasDeletions());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">检测索引中是否有</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Document</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">被标记删除</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(2, reader.MaxDoc());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">当前下一个文档序号仍然为</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">2<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(1, reader.NumDocs());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">当前索引中文档<span>数变成</span></span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Close();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">此时真正从物理上删除之前被标记的文档</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader = IndexReader.<span>Open(</span>dir);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(2, reader.MaxDoc());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(1, reader.NumDocs());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Close();<br />&nbsp;&nbsp;&nbsp; }</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; [Test]<br />&nbsp;&nbsp;&nbsp; public void DeleteAfterIndexMerge()&nbsp;&nbsp;&nbsp;&nbsp;//</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">在索引重排之后</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexReader reader = IndexReader.Open(dir);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(2, reader.MaxDoc());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(2, reader.NumDocs());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Delete(1);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexWriter writer = new IndexWriter(dir, GetAnalyzer(), false);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.Optimize();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">索引重排</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader = IndexReader.Open(dir);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsFalse(reader.IsDeleted(1));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.IsFalse(reader.HasDeletions());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(1, reader.MaxDoc());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">索引重排后</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">下一个文档序号变为</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.<span>AreEqual(</span>1, reader.NumDocs());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Close();<br />&nbsp;&nbsp;&nbsp; }<br />}</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><br /></span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">当然你也可以不通过文档序号进行删除工作</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">采用下面的方法</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">可以从索引中删除包含特定的内容文档</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">IndexReader reader = <span>IndexReader.Open(</span>dir);<br />reader.Delete(new Term(&quot;city&quot;, &quot;Amsterdam&quot;));<br />reader.Close();</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">你还可以通过</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">reader.UndeleteAll()</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这个方法取消前面所做的标记</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">即在</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">read.Close()</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">调用之前取消所有的删除工作</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"> </span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">3. </span></b><b><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">更新索引中的文档</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp; </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">这个功能</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Lucene</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">没有支持</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">, </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">只有通过删除后在添加来实现</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">. </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">看看代码</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">很好理解的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">[</span><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">TestFixture]<br />public class DocumentUpdateTest : BaseIndexingTestCase<br />{<br />&nbsp;&nbsp;&nbsp; [Test]<br />&nbsp;&nbsp;&nbsp; public void Update()<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(1, GetHitCount(&quot;city&quot;, &quot;Amsterdam&quot;));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexReader reader = IndexReader.Open(dir);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Delete(new Term(&quot;city&quot;, &quot;Amsterdam&quot;));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(0, GetHitCount(&quot;city&quot;, &quot;Amsterdam&quot;));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexWriter writer = new IndexWriter(dir, GetAnalyzer(),false);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document doc = new Document();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Keyword(&quot;id&quot;, &quot;1&quot;));</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.UnIndexed(&quot;country&quot;, &quot;Netherlands&quot;));</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.UnStored(&quot;contents&quot;,&quot;Amsterdam has lots of bridges&quot;));</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Text(&quot;city&quot;, &quot;Haag&quot;));</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.AddDocument(doc);</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.Optimize();</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.Close();</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assert.AreEqual(1, GetHitCount(&quot;city&quot;, &quot;Haag&quot;));</span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-font-kerning: 0pt"><br /></span></b><b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; }</span></b><span lang="EN-US" style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;</span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; protected override Analyzer GetAnalyzer()<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new WhitespaceAnalyzer();&nbsp; //</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">注意此处如果用</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">SimpleAnalyzer</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">搜索会失败</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">因为建立索引的时候使用的</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">SimpleAnalyse</span></b><b><span style="COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: 'Courier New'; mso-font-kerning: 0pt">它会将所有字母变成小写</span></b><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; }</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align="left"><b><span lang="EN-US" style="COLOR: #3366ff; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; <span>private</span> int GetHitCount(String fieldName, String searchString)<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexSearcher searcher = new IndexSearcher(dir);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term t = new Term(fieldName, searchString);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Query query = new TermQuery(t);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hits hits = searcher.Search(query);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int hitCount = hits.Length();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; searcher.Close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return hitCount;<br />&nbsp;&nbsp;&nbsp; }<br />}</span></b><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"></span></p>
<p style="TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left"><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">需要注意的是以上所有有关索引的操作</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">为了避免频繁的打开和关闭</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Writer</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Reader.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">又由于添加和删除是不同的连接</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">(Writer, Reader)</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">做的</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">所以应该尽可能的将添加文档的操作放在一起批量执行</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">,</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">然后将删除文档的操作也放在一起批量执行</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span><span style="COLOR: #333333; FONT-FAMILY: 宋体; mso-ascii-font-family: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-hansi-font-family: Georgia; mso-font-kerning: 0pt">避免添加删除交替进行</span><span lang="EN-US" style="COLOR: #333333; FONT-FAMILY: Georgia; mso-bidi-font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">.</span></p>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=82</link>
			<title><![CDATA[lucene.net系列一]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,10 Nov 2008 14:17:23 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=82</guid>	
		<description><![CDATA[<p style="TEXT-INDENT: 2em">本文介绍了什么是lucene,Lucene能做什么.</p>
<p style="TEXT-INDENT: 2em">如何从一个文件夹下的所有txt文件中查找特定的词?</p>
<p style="TEXT-INDENT: 2em">本文将围绕该个实例介绍了lucene.NET的索引的建立以及如何针对索引进行搜索.最后还将给出源代码供大家学习.</p>
<p style="TEXT-INDENT: 2em"><font color="#ff4666"><a href="http://www.alphatom.com/component/option,com_docman/task,doc_download/gid,5/lang,/">源代码下载</a></font></p>
<p style="TEXT-INDENT: 2em">What&rsquo;s Lucene</p>
<p style="TEXT-INDENT: 2em">Lucene是一个信息检索的函数库(Library),利用它你可以为你的应用加上索引和搜索的功能.</p>
<p style="TEXT-INDENT: 2em">Lucene的使用者不需要深入了解有关全文检索的知识,仅仅学会使用库中的一个类,你就为你的应用实现全文检索的功能.</p>
<p style="TEXT-INDENT: 2em">不过千万别以为Lucene是一个象google那样的搜索引擎,Lucene甚至不是一个应用程序,它仅仅是一个工具,一个Library.你也可以把它理解为一个将索引,搜索功能封装的很好的一套简单易用的API.利用这套API你可以做很多有关搜索的事情,而且很方便.</p>
<p style="TEXT-INDENT: 2em">What Can Lucene Do</p>
<p style="TEXT-INDENT: 2em">Lucene可以对任何的数据做索引和搜索. Lucene不管数据源是什么格式,只要它能被转化为文字的形式,就可以被Lucene所分析利用.也就是说不管是MS word, HTML ,pdf还是其他什么形式的文件只要你可以从中抽取出文字形式的内容就可以被Lucene所用.你就可以用Lucene对它们进行索引以及搜索.</p>
<p style="TEXT-INDENT: 2em">How To Use Lucene --- A Simple Example</p>
<p style="TEXT-INDENT: 2em">示例介绍:</p>
<p style="TEXT-INDENT: 2em">为作为输入参数的文件夹下的所有txt类型的文件做索引,做好的索引文件放入index文件夹.</p>
<p style="TEXT-INDENT: 2em">然后在索引的基础上对文件进行全文搜索.</p>
<p style="TEXT-INDENT: 2em">1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 建立索引</p>
<p style="TEXT-INDENT: 2em">IndexWriter writer = new IndexWriter(&quot;index&quot;, new StandardAnalyzer(), true);</p>
<p style="TEXT-INDENT: 2em">IndexDocs(writer, new System.IO.FileInfo(args[0]));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
<p style="TEXT-INDENT: 2em">writer.Optimize();</p>
<p style="TEXT-INDENT: 2em">writer.Close(); </p>
<p style="TEXT-INDENT: 2em">IndexWriter是对索引进行写操作的一个类,利用它可以创建一个索引对象然后往其中添加文件.需要注意它并不是唯一可以修改索引的类.在索引建好后利用其他类还可以对其进行修改.</p>
<p style="TEXT-INDENT: 2em">构造函数第一个参数是建立的索引所要放的文件夹的名字.第二个参数是一个分析对象,主要用于从文本中抽取那些需要建立索引的内容,把不需要参与建索引的文本内容去掉.比如去掉一些a the之类的常用词,还有决定是否大小写敏感.不同的选项通过指定不同的分析对象控制.第三个参数用于确定是否覆盖原有索引的.</p>
<p style="TEXT-INDENT: 2em">第二步就是利用这个writer往索引中添加文件.具体后面再说.</p>
<p style="TEXT-INDENT: 2em">第三步进行优化.</p>
<p style="TEXT-INDENT: 2em">第四步关闭writer.</p>
<p style="TEXT-INDENT: 2em">&nbsp;</p>
<p style="TEXT-INDENT: 2em">下面具体看看第二步:</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;public static void IndexDirectory(IndexWriter writer, FileInfo file)</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Directory.Exists(file.FullName))</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String[] files = Directory.GetFileSystemEntries(file.FullName);</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // an IO error could occur</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (files != null)</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; files.Length; i++)</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexDirectory(writer, new FileInfo(files[i]));&nbsp; //这里是一个递归</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (file.Extension == &quot;.txt&quot;)</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IndexFile(file, writer);</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private static void IndexFile(FileInfo file, IndexWriter writer)</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.Out.WriteLine(&quot;adding &quot; + file);</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Document doc = new Document();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Keyword(&quot;filename&quot;, file.FullName));</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doc.Add(Field.Text(&quot;contents&quot;, new StreamReader(file.FullName)));</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer.AddDocument(doc);</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (FileNotFoundException fnfe)</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p style="TEXT-INDENT: 2em">主要就是两个函数一个用于处理文件夹(不是为文件夹建立索引),一个用于真正为文件建立索引.</p>
<p style="TEXT-INDENT: 2em">因此主要集中看一下IndexFile这个方法.首先建立Document对象,然后为Document对象添加一些属性Field.你可以把Document对象看成是虚拟文件,将来将从此获取信息.而Field则看成是描述此虚拟文件的元数据(metadata).</p>
<p style="TEXT-INDENT: 2em">其中Field包括四个类型:
<table cellspacing="0" cellpadding="0" border="1">
    <tbody>
        <tr>
            <td width="91">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">Keywork</p>
            </td>
            <td width="477">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">该类型的数据将不被分析,而会被索引并保存保存在索引中.</p>
            </td>
        </tr>
        <tr>
            <td width="91">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">UnIndexed</p>
            </td>
            <td width="477">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">该类型的数据不会被分析也不会被索引,但是会保存在索引.</p>
            </td>
        </tr>
        <tr>
            <td width="91">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">UnStored</p>
            </td>
            <td width="477">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">和UnIndexed刚好相反,被分析被索引,但是不被保存.</p>
            </td>
        </tr>
        <tr>
            <td width="91">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">Text</p>
            </td>
            <td width="477">
            <p>&nbsp;</p>
            <p style="TEXT-INDENT: 2em">和UnStrored类似.如果值的类型为string还会被保存.如果值的类型Reader就不会被保存和UnStored一样.</p>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p style="TEXT-INDENT: 2em">&nbsp;</p>
<p style="TEXT-INDENT: 2em">最后将每一个Document添加到索引当中.</p>
<p style="TEXT-INDENT: 2em">需要注意的是索引不仅可以建立在文件系统上,也可以建立在内存中.</p>
<p style="TEXT-INDENT: 2em">例如</p>
<p style="TEXT-INDENT: 2em">IndexWriter writer = new IndexWriter(&quot;index&quot;, new StandardAnalyzer(), true);</p>
<p style="TEXT-INDENT: 2em">在第一个参数不是指定文件夹的名字而是使用Directory对象,并使用它的子类RAMDirectory,就可以将索引建立在内存当中.</p>
<p style="TEXT-INDENT: 2em">&nbsp;</p>
<p style="TEXT-INDENT: 2em">2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对索引进行搜索</p>
<p style="TEXT-INDENT: 2em">IndexSearcher indexSearcher= new IndexSearcher(indexDir);</p>
<p style="TEXT-INDENT: 2em">Query query = QueryParser.Parse(queryString, &quot;contents&quot;,new StandardAnalyzer());</p>
<p style="TEXT-INDENT: 2em">Hits hits = indexSearcher.Search(query);</p>
<p style="TEXT-INDENT: 2em">&nbsp;第一步利用IndexSearcher打开索引文件用于后面搜索,其中的参数是索引文件的路径.</p>
<p style="TEXT-INDENT: 2em">第二步使用QueryParser将可读性较好的查询语句(比如查询的词lucene ,以及一些高级方式lucene AND .net)转化为Lucene内部使用的查询对象.</p>
<p style="TEXT-INDENT: 2em">第三步执行搜索.并将结果返回到hits集合.需要注意的是Lucene并不是一次将所有的结果放入hits中而是采取一次放一部分的方式.出于空间考虑.</p>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=81</link>
			<title><![CDATA[JAVA 强制数据类型转换]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,10 Nov 2008 14:10:33 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=81</guid>	
		<description><![CDATA[class Change{<br />　　 public static void main(String[] args){<br />　　 <br />　　 short shortvar=0; <br />　　 int intvar=0; <br />　　 String stringvar;<br />　　 float floatvar=9.99f; <br />　　 double doublevar=99999999.99;<br />　　 char charvar='9';<br />　　 String intstring=&quot;10&quot;; <br />　　 String floatstring=&quot;10.1f&quot;; <br />　　 String longstring=&quot;99999999&quot;;<br />　　 String doubleString=&quot;99999999.9&quot;;<br />　　 String s1=&quot;0&quot;;<br />　　 String s2=&quot;abc&quot;;<br />　　 String s3=&quot;true&quot;;<br />　　<br />　　 //1.short--&gt;int<br />　　 intvar=shortvar; <br />　　 System.out.println(intvar);<br /><br />//2.int--&gt;short <br />shortvar= (short) intvar ;<br />　　 System.out.println(shortvar);<br />　　 <br />//3.int-&gt;String <br />　　 intvar=1; <br />　　 stringvar=String.valueOf (intvar); <br />　　 System.out.println(stringvar);<br />　　 <br />　　 //4.float-&gt;String <br />　　 stringvar=String.valueOf (floatvar); <br />　　 System.out.println(stringvar);<br />　　 <br />　　 //5. double-&gt;String <br />　　 stringvar=String.valueOf (doublevar); <br />　　 System.out.println(stringvar);<br />　　 <br />　　 //6. char-&gt;String <br />　　 stringvar=String.valueOf (charvar);<br />　　 System.out.println(stringvar); <br />　　 <br />　　 //7 String-&gt;int、float、long、double <br />　　 int i=Integer.parseInt (intstring); <br />　　 float f= Float.parseFloat (floatstring); <br />　　 long lo=Long. parseLong (longstring); <br />　　 double d=Double. parseDouble(doubleString); <br />　　 System.out.println(i+&quot;\n&quot;+f+&quot;\n&quot;+lo+&quot;\n&quot;+d);<br />　　<br />　　 //8 String-&gt;byte、short <br />　　 byte b=Byte.parseByte(s1); <br />　　 short sh=Short.parseShort(s1);<br />　　 System.out.println(b+&quot;\n&quot;+sh) ;<br />　　 <br />　　 //9 String-&gt;char <br />　　 char a=s2.charAt(0);<br />　　 System.out.println(a); <br />　　 <br />　　 //10 String--&gt;boolean <br />　　 boolean flag=Boolean.getBoolean(s3); <br />　　 System.out.println(s3);<br />　　 <br />　　 <br />　　 }<br />　　}&nbsp;&nbsp;<br />]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=80</link>
			<title><![CDATA[Lucene 2.1研究：文件存储]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,10 Nov 2008 11:25:21 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=80</guid>	
		<description><![CDATA[一．&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lucene原始存储数据类型（Primitive&nbsp;Types）<br/><br/>&nbsp;<br/><br/>类型名称<br/>&nbsp;说明<br/>&nbsp;<br/>Byte<br/>&nbsp;8&nbsp;byte<br/>&nbsp;<br/>UInt32<br/>&nbsp;32&nbsp;byte四字节无符号整型，高位优先<br/>&nbsp;<br/>UInt64<br/>&nbsp;64byte八字节无符号整型，高位优先<br/>&nbsp;<br/>VInt<br/>&nbsp;可变长度整型。0-127单字节，128-16383两字节，类推<br/>&nbsp;<br/>Chars<br/>&nbsp;UNICODE字符串<br/>&nbsp;<br/>String<br/>&nbsp;写入格式为：VInt，Chars，字符串长度加字符串<br/>&nbsp;<br/><br/>&nbsp;<br/><br/>二．&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lucene索引文件<br/><br/>1．&nbsp;&nbsp;Segments<br/><br/>文件名称：segments_N，N为36进制数。<br/><br/>&nbsp;<br/><br/>说明：在一个索引目录中，至少存在一个Segments文件，但可索引活动的只会有一个：N值最大的。其他的Segments文件可能为临时文件，一般情况是索引修改进程没有完成。<br/><br/>&nbsp;<br/><br/>格式：Format，Version，NameCounter，SegCount，&lt;SegName，SegSize，DelGen，HasSingleNormFile，NumField，NormGenNumField，IsCompoundFile&gt;SegCount<br/><br/>Format，NameCounter，SegCount，SegCount，SegSize，NumField：UInt32<br/><br/>Version，DelGen，NormGen：UInt64<br/><br/>SegName：String<br/><br/>IsCompound，HasSingleNormFile：Byte<br/><br/>&nbsp;<br/><br/>格式说明：Format&nbsp;=&nbsp;SegmentInfos.FORMAT_SINGLE_NORM_FILE&nbsp;=&nbsp;-2；Version当前时间与UTC时间的差值的毫秒数，每次对索引进行修改时会变化；SegName是所有索引生成文件的前缀；SegSize是当前Segment中包含的Document的数量；<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>FF&nbsp;FF&nbsp;FF&nbsp;FD：FOMAT&nbsp;=&nbsp;-2，UInt32<br/><br/>00&nbsp;00&nbsp;01&nbsp;13&nbsp;29&nbsp;30&nbsp;B6&nbsp;33：Version&nbsp;=&nbsp;1181807064627，UInt64<br/><br/>00&nbsp;00&nbsp;00&nbsp;01：NameCount&nbsp;=&nbsp;1，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;01：SegmentCount&nbsp;=&nbsp;1，UInt32<br/><br/>02：SegmentNamePrefixLength&nbsp;=&nbsp;2，VInt<br/><br/>5F&nbsp;30：SegmentName&nbsp;=&nbsp;“_0”，Chars<br/><br/>00&nbsp;00&nbsp;00&nbsp;01：SegSize&nbsp;=&nbsp;1，UInt32<br/><br/>FF&nbsp;FF&nbsp;FF&nbsp;FF&nbsp;FF&nbsp;FF&nbsp;FF&nbsp;FF：DelGen&nbsp;=&nbsp;-1，UInt64<br/><br/>01：HasSingleNormFile&nbsp;=&nbsp;1，Byte<br/><br/>FF&nbsp;FF&nbsp;FF&nbsp;FF：NumField&nbsp;=&nbsp;-1，UInt32<br/><br/>FF：IsCompoundFile&nbsp;=&nbsp;-1，Byte<br/><br/>&nbsp;<br/><br/>在2.1版本中还会生成segment.gen文件，主要保存了索引计数，格式为：Version（SegmentInfos.LOCKLESS&nbsp;=&nbsp;-2），Generation，Generation。<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>FF&nbsp;FF&nbsp;FF&nbsp;FE：Version&nbsp;=&nbsp;-2，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;02：Generation&nbsp;=&nbsp;2，UInt64<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;02：Generation&nbsp;=&nbsp;2，UInt64<br/><br/>&nbsp;<br/><br/>2．&nbsp;&nbsp;Field&nbsp;Info<br/><br/>文件名称：SegmentName.fnm。<br/><br/>&nbsp;<br/><br/>说明：保存了所有Field的名称。<br/><br/>&nbsp;<br/><br/>格式：FieldCount，&lt;FieldName，FieldBits&gt;FieldCount<br/><br/>FieldCount：VInt<br/><br/>FieldName：String<br/><br/>FieldBits：Byte<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>01：FieldCount&nbsp;=&nbsp;1，VInt<br/><br/>04：FieldNamePrefixLength&nbsp;=&nbsp;4，VInt<br/><br/>49&nbsp;6E&nbsp;66&nbsp;6F：FieldName&nbsp;=&nbsp;“Info”，Chars<br/><br/>01：Bits&nbsp;=&nbsp;1，Byte<br/><br/>&nbsp;<br/><br/>3．&nbsp;&nbsp;Stored&nbsp;Field&nbsp;Index<br/><br/>文件名称：SegmentName.fdx<br/><br/>&nbsp;<br/><br/>说明：保存了每个Document的Field&nbsp;Data的地址指针<br/><br/>&nbsp;<br/><br/>格式：&lt;FieldValuesPosition&gt;SegSize<br/><br/>FieldValuesPosition：UInt64<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00：FieldValuesPosition&nbsp;=&nbsp;0，UInt64<br/><br/>&nbsp;<br/><br/>4．&nbsp;&nbsp;Stroed&nbsp;Field&nbsp;Data<br/><br/>文件名称：SegmentName.fdt<br/><br/>&nbsp;<br/><br/>说明：保存了每个Document的需要存储的Field数据。<br/><br/>&nbsp;<br/><br/>格式：&lt;DocFieldData&gt;SegSize<br/><br/>DocFieldData：FieldCount，&lt;FieldNum，Bits，Value&gt;FieldCount<br/><br/>FieldCount：VInt<br/><br/>FieldNum：Vint<br/><br/>Bits：Byte<br/><br/>Value：String&nbsp;|&nbsp;BinaryValue（取决于Bits）<br/><br/>BinaryValue：ValueSize，&lt;Byte&gt;^ValueSize<br/><br/>ValueSize：VInt<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>01：FieldCount&nbsp;=&nbsp;1，VInt<br/><br/>00：FieldNum&nbsp;=&nbsp;0，VInt<br/><br/>01：Bits&nbsp;=&nbsp;1，Byte<br/><br/>17：FieldValuePrefixLength&nbsp;=&nbsp;23，VInt<br/><br/>49&nbsp;20&nbsp;77&nbsp;72&nbsp;69&nbsp;74&nbsp;65&nbsp;20&nbsp;61&nbsp;20&nbsp;6C&nbsp;65&nbsp;74&nbsp;74&nbsp;65&nbsp;72&nbsp;20&nbsp;6C&nbsp;65&nbsp;74&nbsp;74&nbsp;65&nbsp;72：Value&nbsp;=&nbsp;“I&nbsp;write&nbsp;a&nbsp;letter&nbsp;letter”，Chars<br/><br/>&nbsp;<br/><br/>5．&nbsp;&nbsp;Term&nbsp;Info&nbsp;Index<br/><br/>文件名称：SegmentName.tii<br/><br/>&nbsp;<br/><br/>说明：保存了所有Term&nbsp;Inofs（.its）文件的索引间隔条目。<br/><br/>&nbsp;<br/><br/>格式：TIVersion，IndexTermCount，IndexInterval，SkipIntervala，MaxSkipLevels，TermIndices<br/><br/>TIVersion：UInt32<br/><br/>IndexTermCount：UInt64<br/><br/>IndexInterval：UInt32<br/><br/>SkipInterval：UInt32<br/><br/>TermIndeices：&lt;TermInfo，IndexDelta&gt;IndexTermCount<br/><br/>IndexDelta：VInt<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/>&nbsp;<br/><br/>FF&nbsp;FF&nbsp;FF&nbsp;FE：TIVersion&nbsp;=&nbsp;-2，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;01：TermCount&nbsp;=&nbsp;1，UInt64<br/><br/>00&nbsp;00&nbsp;00&nbsp;08：IndexInterval&nbsp;=&nbsp;128，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;10：SkipInterval&nbsp;=&nbsp;16，UInt32<br/><br/>00：MaxSkipLevels&nbsp;=&nbsp;0，Byte<br/><br/>&nbsp;<br/><br/>6．&nbsp;&nbsp;Term&nbsp;Infos<br/><br/>文件名称：SegmentName.tis<br/><br/>&nbsp;<br/><br/>说明：存储了所有Term的信息。<br/><br/>&nbsp;<br/><br/>格式：TIVersion，IndexTermCount，IndexInterval，SkipIntervala，MaxSkipLevels，TIVersion：UInt32<br/><br/>IndexTermCount：UInt64<br/><br/>IndexInterval：UInt32<br/><br/>SkipInterval：UInt32<br/><br/>MaxSkipLevels：VInt<br/><br/>TermInfos：&lt;Term，DocFreq，FreqDelta，ProxDelta，SkipDelta&gt;TermCount<br/><br/>Term：&lt;PriefixLength，Suffix，FieldNum&gt;<br/><br/>&nbsp;<br/><br/>格式说明：Term按照字典顺序排序；Term的内容是可以共享的。例如：上一个Term为“bone”，当前Term为“boy”，则当前的Temr的PrefixLength为2，Suffix为“y”。<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/>&nbsp;<br/><br/>FF&nbsp;FF&nbsp;FF&nbsp;FE：TIVersion&nbsp;=&nbsp;-2，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;01：TermCount&nbsp;=&nbsp;1，UInt64<br/><br/>00&nbsp;00&nbsp;00&nbsp;08：IndexInterval&nbsp;=&nbsp;128，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;10：SkipInterval&nbsp;=&nbsp;16，UInt32<br/><br/>00：MaxSkipLevels&nbsp;=&nbsp;0，Byte<br/><br/>01：TermTextPrefixLength&nbsp;=&nbsp;1，VInt<br/><br/>69：TermText&nbsp;=&nbsp;“i”，Chars<br/><br/>00：FieldNumber&nbsp;=&nbsp;0，VInt<br/><br/>01：DocFreq&nbsp;=&nbsp;1，VInt<br/><br/>00：FreqDelta&nbsp;=&nbsp;0，VInt<br/><br/>00：ProxDelta&nbsp;=&nbsp;0，VInt<br/><br/>00：SkipDelta&nbsp;=&nbsp;0，Vint<br/><br/>&nbsp;<br/><br/>以下Term类似<br/><br/>&nbsp;<br/><br/>7：Frequencies&nbsp;File<br/><br/>文件名称：SegmentName.frq<br/><br/>&nbsp;<br/><br/>说明：<br/><br/>&nbsp;<br/><br/>格式：<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/>&nbsp;<br/><br/>8.&nbsp;Positions&nbsp;File<br/><br/>文件名称：SegmentName.prx<br/><br/>&nbsp;<br/><br/>说明：保存了每个Term在Document中的位置集合。<br/><br/>&nbsp;<br/><br/>格式：<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>9.TermVectors&nbsp;Iindex&nbsp;File<br/><br/>文件名称：SegmentName.tvx<br/><br/>&nbsp;<br/><br/>说明：保存了在.tvd中的文档数据的指针。<br/><br/>&nbsp;<br/><br/>格式：TVXVersion，&lt;DocumentPosition&gt;NumDocs<br/><br/>TVXVersion：UInt32<br/><br/>DcoumentPosition：UInt64<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>00&nbsp;00&nbsp;00&nbsp;02：TVXVersion&nbsp;=&nbsp;2，UInt32<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;04：DocumentPosition&nbsp;=&nbsp;4，UInt64<br/><br/>&nbsp;<br/><br/>&nbsp;<br/><br/>10.Term&nbsp;Vectors&nbsp;Document<br/><br/>文件名称：SegmentName.tvd<br/><br/>&nbsp;<br/><br/>说明：<br/><br/>&nbsp;<br/><br/>格式：TVDVersion，&lt;NumFields，FieldNums，FieldPositions&gt;NumDocs<br/><br/>TVDVersion：UInt32<br/><br/>NumFields：VInt<br/><br/>FieldNums：&lt;FieldNumDelta&nbsp;&gt;NumFields<br/><br/>FieldPosition：VInt<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/>&nbsp;<br/><br/>00&nbsp;00&nbsp;00&nbsp;02：TVDVersion&nbsp;=&nbsp;2，UInt32<br/><br/>01：NumFields&nbsp;=&nbsp;1，VInt<br/><br/>00：FieldNumDelta&nbsp;=&nbsp;0，VInt<br/><br/>04：FieldPosition&nbsp;=&nbsp;4，VInt<br/><br/>&nbsp;<br/><br/>11.Term&nbsp;Vectors&nbsp;Field<br/><br/>文件名称：SegmentName.tvf<br/><br/>&nbsp;<br/><br/>说明：<br/><br/>&nbsp;<br/><br/>&nbsp;<br/><br/>格式：TVFVersion，&lt;NumTerms，Position/Offset，TermFreqs&gt;NumFields<br/><br/>TVFVersion：UInt32<br/><br/>NumTerms：VInt<br/><br/>Position/Offset：Byte<br/><br/>TermFreqs：&lt;TermText，TermFreq，Positions/Offsets&gt;NumTerms<br/><br/>TermText：&lt;PrefixLength，Suffix&gt;<br/><br/>PrefixLength：VInt<br/><br/>Suffix：Chars<br/><br/>TermFreq：VInt<br/><br/>Position：&lt;VInt&gt;TermFreq<br/><br/>Offsets：&lt;VInt，VInt&gt;TermFreq<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>00&nbsp;00&nbsp;00&nbsp;02：TVFVersion&nbsp;=&nbsp;2，UInt32<br/><br/>03：NumTerms&nbsp;=&nbsp;3，VInt<br/><br/>00：<br/><br/>00：<br/><br/>01：TermTextPrefixLength&nbsp;=&nbsp;1，VInt<br/><br/>69：TermText&nbsp;=&nbsp;“i”，Chars<br/><br/>01：TermFreq&nbsp;=&nbsp;1，VInt<br/><br/>00：Position/Offset&nbsp;=&nbsp;0，VInt<br/><br/>06：TermTextPrefixLength&nbsp;=&nbsp;6，VInt<br/><br/>6C&nbsp;65&nbsp;74&nbsp;74&nbsp;65&nbsp;72：TextText&nbsp;=&nbsp;“letter”，VInt<br/><br/>02：TermFreq&nbsp;=&nbsp;2，VInt<br/><br/>00：Position/Offset&nbsp;=&nbsp;0，VInt<br/><br/>05：TermTextPrefixlength&nbsp;=&nbsp;5，VInt<br/><br/>77&nbsp;72&nbsp;69&nbsp;74&nbsp;65：TermText&nbsp;=&nbsp;“write”，Chars<br/><br/>01：Position/Offset&nbsp;=&nbsp;1，VInt<br/><br/>&nbsp;<br/><br/>12.Compound&nbsp;File<br/><br/>文件名称：SegmentName.cfs<br/><br/>&nbsp;<br/><br/>说明：当采用复合文件建立索引时，所有索引文件会保存在一个.cfs文件内。<br/><br/>&nbsp;<br/><br/>格式：FileCount，&lt;DataOffset，FileName&gt;FielCount，FileDataFielCount<br/><br/>FielCount：VInt<br/><br/>DataOffset：UInt64<br/><br/>FileName：String<br/><br/>FielData：文件原始数据（raw&nbsp;file&nbsp;data）<br/><br/>&nbsp;<br/><br/>格式说明：<br/><br/>&nbsp;<br/><br/>示例：<br/><br/><br/><br/>&nbsp;<br/><br/>0B：FileCount&nbsp;=&nbsp;8，VInt<br/><br/>00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;00&nbsp;A6：DataOffset&nbsp;=&nbsp;166，UInt64<br/><br/>06：FileNamePrefixLength&nbsp;=&nbsp;6，VInt<br/><br/>5F&nbsp;30&nbsp;2E&nbsp;66&nbsp;6E&nbsp;6D：FileName&nbsp;=&nbsp;“_0.fnm”，Chars<br/><br/>根据文件数据偏移量（DataOffset）&nbsp;166，可以知道字段信息文件（Field&nbsp;Info）“_0.fnm”的数据存储起始位置在167处。其他文件类]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=79</link>
			<title><![CDATA[初识 Lucene]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,10 Nov 2008 10:30:20 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=79</guid>	
		<description><![CDATA[本文首先介绍了Lucene的一些基本概念，然后开发了一个应用程序演示了利用Lucene建立索引并在该索引上进行搜索的过程。<br/>Lucene&nbsp;简介<br/><br/>Lucene&nbsp;是一个基于&nbsp;Java&nbsp;的全文信息检索工具包，它不是一个完整的搜索应用程序，而是为你的应用程序提供索引和搜索功能。Lucene&nbsp;目前是&nbsp;Apache&nbsp;Jakarta&nbsp;家族中的一个开源项目。也是目前最为流行的基于&nbsp;Java&nbsp;开源全文检索工具包。<br/><br/>目前已经有很多应用程序的搜索功能是基于&nbsp;Lucene&nbsp;的，比如&nbsp;Eclipse&nbsp;的帮助系统的搜索功能。Lucene&nbsp;能够为文本类型的数据建立索引，所以你只要能把你要索引的数据格式转化的文本的，Lucene&nbsp;就能对你的文档进行索引和搜索。比如你要对一些&nbsp;HTML&nbsp;文档，PDF&nbsp;文档进行索引的话你就首先需要把&nbsp;HTML&nbsp;文档和&nbsp;PDF&nbsp;文档转化成文本格式的，然后将转化后的内容交给&nbsp;Lucene&nbsp;进行索引，然后把创建好的索引文件保存到磁盘或者内存中，最后根据用户输入的查询条件在索引文件上进行查询。不指定要索引的文档的格式也使&nbsp;Lucene&nbsp;能够几乎适用于所有的搜索应用程序。<br/><br/>图&nbsp;1&nbsp;表示了搜索应用程序和&nbsp;Lucene&nbsp;之间的关系，也反映了利用&nbsp;Lucene&nbsp;构建搜索应用程序的流程：<br/><br/><br/>图1.&nbsp;搜索应用程序和&nbsp;Lucene&nbsp;之间的关系<br/><img src="http://www-128.ibm.com/developerworks/cn/java/j-lo-lucene1/fig001.jpg" border="0" alt=""/><br/>索引和搜索<br/><br/>索引是现代搜索引擎的核心，建立索引的过程就是把源数据处理成非常方便查询的索引文件的过程。为什么索引这么重要呢，试想你现在要在大量的文档中搜索含有某个关键词的文档，那么如果不建立索引的话你就需要把这些文档顺序的读入内存，然后检查这个文章中是不是含有要查找的关键词，这样的话就会耗费非常多的时间，想想搜索引擎可是在毫秒级的时间内查找出要搜索的结果的。这就是由于建立了索引的原因，你可以把索引想象成这样一种数据结构，他能够使你快速的随机访问存储在索引中的关键词，进而找到该关键词所关联的文档。Lucene&nbsp;采用的是一种称为反向索引（inverted&nbsp;index）的机制。反向索引就是说我们维护了一个词/短语表，对于这个表中的每个词/短语，都有一个链表描述了有哪些文档包含了这个词/短语。这样在用户输入查询条件的时候，就能非常快的得到搜索结果。我们将在本系列文章的第二部分详细介绍&nbsp;Lucene&nbsp;的索引机制，由于&nbsp;Lucene&nbsp;提供了简单易用的&nbsp;API，所以即使读者刚开始对全文本进行索引的机制并不太了解，也可以非常容易的使用&nbsp;Lucene&nbsp;对你的文档实现索引。<br/><br/>对文档建立好索引后，就可以在这些索引上面进行搜索了。搜索引擎首先会对搜索的关键词进行解析，然后再在建立好的索引上面进行查找，最终返回和用户输入的关键词相关联的文档。<br/><br/>Lucene&nbsp;软件包分析<br/><br/>Lucene&nbsp;软件包的发布形式是一个&nbsp;JAR&nbsp;文件，下面我们分析一下这个&nbsp;JAR&nbsp;文件里面的主要的&nbsp;JAVA&nbsp;包，使读者对之有个初步的了解。<br/><br/>Package:&nbsp;o&#114;g.apache.lucene.document<br/><br/>这个包提供了一些为封装要索引的文档所需要的类，比如&nbsp;Document,&nbsp;Field。这样，每一个文档最终被封装成了一个&nbsp;Document&nbsp;对象。<br/><br/>Package:&nbsp;o&#114;g.apache.lucene.analysis<br/><br/>这个包主要功能是对文档进行分词，因为文档在建立索引之前必须要进行分词，所以这个包的作用可以看成是为建立索引做准备工作。<br/><br/>Package:&nbsp;o&#114;g.apache.lucene.index<br/><br/>这个包提供了一些类来协助创建索引以及对创建好的索引进行更新。这里面有两个基础的类：IndexWriter&nbsp;和&nbsp;IndexReader，其中&nbsp;IndexWriter&nbsp;是用来创建索引并添加文档到索引中的，IndexReader&nbsp;是用来删除索引中的文档的。<br/><br/>Package:&nbsp;o&#114;g.apache.lucene.search<br/><br/>这个包提供了对在建立好的索引上进行搜索所需要的类。比如&nbsp;IndexSearcher&nbsp;和&nbsp;Hits,&nbsp;IndexSearcher&nbsp;定义了在指定的索引上进行搜索的方法，Hits&nbsp;用来保存搜索得到的结果。<br/><br/><br/>一个简单的搜索应用程序<br/><br/>假设我们的电脑的目录中含有很多文本文档，我们需要查找哪些文档含有某个关键词。为了实现这种功能，我们首先利用&nbsp;Lucene&nbsp;对这个目录中的文档建立索引，然后在建立好的索引中搜索我们所要查找的文档。通过这个例子读者会对如何利用&nbsp;Lucene&nbsp;构建自己的搜索应用程序有个比较清楚的认识。<br/><br/><br/>建立索引<br/><br/>为了对文档进行索引，Lucene&nbsp;提供了五个基础的类，他们分别是&nbsp;Document,&nbsp;Field,&nbsp;IndexWriter,&nbsp;Analyzer,&nbsp;Directory。下面我们分别介绍一下这五个类的用途：<br/><br/>Document<br/><br/>Document&nbsp;是用来描述文档的，这里的文档可以指一个&nbsp;HTML&nbsp;页面，一封电子邮件，或者是一个文本文件。一个&nbsp;Document&nbsp;对象由多个&nbsp;Field&nbsp;对象组成的。可以把一个&nbsp;Document&nbsp;对象想象成数据库中的一个记录，而每个&nbsp;Field&nbsp;对象就是记录的一个字段。<br/><br/>Field<br/><br/>Field&nbsp;对象是用来描述一个文档的某个属性的，比如一封电子邮件的标题和内容可以用两个&nbsp;Field&nbsp;对象分别描述。<br/><br/>Analyzer<br/><br/>在一个文档被索引之前，首先需要对文档内容进行分词处理，这部分工作就是由&nbsp;Analyzer&nbsp;来做的。Analyzer&nbsp;类是一个抽象类，它有多个实现。针对不同的语言和应用需要选择适合的&nbsp;Analyzer。Analyzer&nbsp;把分词后的内容交给&nbsp;IndexWriter&nbsp;来建立索引。<br/><br/>IndexWriter<br/><br/>IndexWriter&nbsp;是&nbsp;Lucene&nbsp;用来创建索引的一个核心的类，他的作用是把一个个的&nbsp;Document&nbsp;对象加到索引中来。<br/><br/>Directory<br/><br/>这个类代表了&nbsp;Lucene&nbsp;的索引的存储的位置，这是一个抽象类，它目前有两个实现，第一个是&nbsp;FSDirectory，它表示一个存储在文件系统中的索引的位置。第二个是&nbsp;RAMDirectory，它表示一个存储在内存当中的索引的位置。<br/><br/>熟悉了建立索引所需要的这些类后，我们就开始对某个目录下面的文本文件建立索引了，清单1给出了对某个目录下的文本文件建立索引的源代码。<br/><br/><br/>清单&nbsp;1.&nbsp;对文本文件建立索引<br/>package&nbsp;TestLucene;<br/>import&nbsp;java.io.File;<br/>import&nbsp;java.io.FileReader;<br/>import&nbsp;java.io.Reader;<br/>import&nbsp;java.util.Date;<br/>import&nbsp;o&#114;g.apache.lucene.analysis.Analyzer;<br/>import&nbsp;o&#114;g.apache.lucene.analysis.standard.StandardAnalyzer;<br/>import&nbsp;o&#114;g.apache.lucene.document.Document;<br/>import&nbsp;o&#114;g.apache.lucene.document.Field;<br/>import&nbsp;o&#114;g.apache.lucene.index.IndexWriter;<br/>/**<br/>&nbsp;*&nbsp;This&nbsp;class&nbsp;demonstrate&nbsp;the&nbsp;process&nbsp;of&nbsp;creating&nbsp;index&nbsp;with&nbsp;Lucene&nbsp;<br/>&nbsp;*&nbsp;for&nbsp;text&nbsp;files<br/>&nbsp;*/<br/>public&nbsp;class&nbsp;TxtFileIndexer&nbsp;{<br/>&#160;&#160;&#160;&#160;public&nbsp;static&nbsp;void&nbsp;main(String[]&nbsp;args)&nbsp;throws&nbsp;Exception{<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//indexDir&nbsp;is&nbsp;the&nbsp;directory&nbsp;that&nbsp;hosts&nbsp;Lucene&#39;s&nbsp;index&nbsp;files<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;&nbsp;&nbsp;indexDir&nbsp;=&nbsp;new&nbsp;File(&#34;D:\\luceneIndex&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//dataDir&nbsp;is&nbsp;the&nbsp;directory&nbsp;that&nbsp;hosts&nbsp;the&nbsp;text&nbsp;files&nbsp;that&nbsp;to&nbsp;be&nbsp;indexed<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;&nbsp;&nbsp;dataDir&nbsp;&nbsp;=&nbsp;new&nbsp;File(&#34;D:\\luceneData&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Analyzer&nbsp;luceneAnalyzer&nbsp;=&nbsp;new&nbsp;StandardAnalyzer();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File[]&nbsp;dataFiles&nbsp;&nbsp;=&nbsp;dataDir.listFiles();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexWriter&nbsp;indexWriter&nbsp;=&nbsp;new&nbsp;IndexWriter(indexDir,luceneAnalyzer,true);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long&nbsp;startTime&nbsp;=&nbsp;new&nbsp;Date().getTime();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;dataFiles.length;&nbsp;i++){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;if(dataFiles[i].isFile()&nbsp;&amp;&amp;&nbsp;dataFiles[i].getName().endsWith(&#34;.txt&#34;)){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.out.println(&#34;Indexing&nbsp;file&nbsp;&#34;&nbsp;+&nbsp;dataFiles[i].getCanonicalPath());<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Document&nbsp;document&nbsp;=&nbsp;new&nbsp;Document();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Reader&nbsp;txtReader&nbsp;=&nbsp;new&nbsp;FileReader(dataFiles[i]);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;document.add(Field.Text(&#34;path&#34;,dataFiles[i].getCanonicalPath()));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;document.add(Field.Text(&#34;contents&#34;,txtReader));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;indexWriter.addDocument(document);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexWriter.optimize();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indexWriter.close();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long&nbsp;endTime&nbsp;=&nbsp;new&nbsp;Date().getTime();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&#34;It&nbsp;takes&nbsp;&#34;&nbsp;+&nbsp;(endTime&nbsp;-&nbsp;startTime)&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;&#34;&nbsp;milliseconds&nbsp;to&nbsp;cr&#101;ate&nbsp;index&nbsp;for&nbsp;the&nbsp;files&nbsp;in&nbsp;directory&nbsp;&#34;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;dataDir.getPath());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#160;&#160;&#160;&#160;}<br/>}<br/>&nbsp;<br/><br/><br/>在清单1中，我们注意到类&nbsp;IndexWriter&nbsp;的构造函数需要三个参数，第一个参数指定了所创建的索引要存放的位置，他可以是一个&nbsp;File&nbsp;对象，也可以是一个&nbsp;FSDirectory&nbsp;对象或者&nbsp;RAMDirectory&nbsp;对象。第二个参数指定了&nbsp;Analyzer&nbsp;类的一个实现，也就是指定这个索引是用哪个分词器对文挡内容进行分词。第三个参数是一个布尔型的变量，如果为&nbsp;true&nbsp;的话就代表创建一个新的索引，为&nbsp;false&nbsp;的话就代表在原来索引的基础上进行操作。接着程序遍历了目录下面的所有文本文档，并为每一个文本文档创建了一个&nbsp;Document&nbsp;对象。然后把文本文档的两个属性：路径和内容加入到了两个&nbsp;Field&nbsp;对象中，接着在把这两个&nbsp;Field&nbsp;对象加入到&nbsp;Document&nbsp;对象中，最后把这个文档用&nbsp;IndexWriter&nbsp;类的&nbsp;add&nbsp;方法加入到索引中去。这样我们便完成了索引的创建。接下来我们进入在建立好的索引上进行搜索的部分。<br/><br/><br/>搜索文档<br/><br/>利用Lucene进行搜索就像建立索引一样也是非常方便的。在上面一部分中，我们已经为一个目录下的文本文档建立好了索引，现在我们就要在这个索引上进行搜索以找到包含某个关键词或短语的文档。Lucene提供了几个基础的类来完成这个过程，它们分别是呢IndexSearcher,&nbsp;Term,&nbsp;Query,&nbsp;TermQuery,&nbsp;Hits.&nbsp;下面我们分别介绍这几个类的功能。<br/><br/>Query<br/><br/>这是一个抽象类，他有多个实现，比如TermQuery,&nbsp;BooleanQuery,&nbsp;PrefixQuery.&nbsp;这个类的目的是把用户输入的查询字符串封装成Lucene能够识别的Query。<br/><br/>Term<br/><br/>Term是搜索的基本单位，一个Term对象有两个String类型的域组成。生成一个Term对象可以有如下一条语句来完成：Term&nbsp;term&nbsp;=&nbsp;new&nbsp;Term(“fieldName”,”queryWord”);&nbsp;其中第一个参数代表了要在文档的哪一个Field上进行查找，第二个参数代表了要查询的关键词。<br/><br/>TermQuery<br/><br/>TermQuery是抽象类Query的一个子类，它同时也是Lucene支持的最为基本的一个查询类。生成一个TermQuery对象由如下语句完成：&nbsp;TermQuery&nbsp;termQuery&nbsp;=&nbsp;new&nbsp;TermQuery(new&nbsp;Term(“fieldName”,”queryWord”));&nbsp;它的构造函数只接受一个参数，那就是一个Term对象。<br/><br/>IndexSearcher<br/><br/>IndexSearcher是用来在建立好的索引上进行搜索的。它只能以只读的方式打开一个索引，所以可以有多个IndexSearcher的实例在一个索引上进行操作。<br/><br/>Hits<br/><br/>Hits是用来保存搜索的结果的。<br/><br/>介绍完这些搜索所必须的类之后，我们就开始在之前所建立的索引上进行搜索了，清单2给出了完成搜索功能所需要的代码。<br/><br/><br/>清单2&nbsp;：在建立好的索引上进行搜索<br/>package&nbsp;TestLucene;<br/>import&nbsp;java.io.File;<br/>import&nbsp;o&#114;g.apache.lucene.document.Document;<br/>import&nbsp;o&#114;g.apache.lucene.index.Term;<br/>import&nbsp;o&#114;g.apache.lucene.search.Hits;<br/>import&nbsp;o&#114;g.apache.lucene.search.IndexSearcher;<br/>import&nbsp;o&#114;g.apache.lucene.search.TermQuery;<br/>import&nbsp;o&#114;g.apache.lucene.store.FSDirectory;<br/>/**<br/>&nbsp;*&nbsp;This&nbsp;class&nbsp;is&nbsp;used&nbsp;to&nbsp;demonstrate&nbsp;the&nbsp;<br/>&nbsp;*&nbsp;process&nbsp;of&nbsp;searching&nbsp;on&nbsp;an&nbsp;existing&nbsp;<br/>&nbsp;*&nbsp;Lucene&nbsp;index<br/>&nbsp;*<br/>&nbsp;*/<br/>public&nbsp;class&nbsp;TxtFileSearcher&nbsp;{<br/>&#160;&#160;&#160;&#160;public&nbsp;static&nbsp;void&nbsp;main(String[]&nbsp;args)&nbsp;throws&nbsp;Exception{<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;queryStr&nbsp;=&nbsp;&#34;lucene&#34;;<br/>&#160;&#160;&#160;&#160;&nbsp;&nbsp;&nbsp;&nbsp;//This&nbsp;is&nbsp;the&nbsp;directory&nbsp;that&nbsp;hosts&nbsp;the&nbsp;Lucene&nbsp;index<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;indexDir&nbsp;=&nbsp;new&nbsp;File(&#34;D:\\luceneIndex&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FSDirectory&nbsp;directory&nbsp;=&nbsp;FSDirectory.getDirectory(indexDir,false);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IndexSearcher&nbsp;searcher&nbsp;=&nbsp;new&nbsp;IndexSearcher(directory);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!indexDir.exists()){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;System.out.println(&#34;The&nbsp;Lucene&nbsp;index&nbsp;is&nbsp;not&nbsp;exist&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;return;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Term&nbsp;term&nbsp;=&nbsp;new&nbsp;Term(&#34;contents&#34;,queryStr.toLowerCase());<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TermQuery&nbsp;luceneQuery&nbsp;=&nbsp;new&nbsp;TermQuery(term);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hits&nbsp;hits&nbsp;=&nbsp;searcher.search(luceneQuery);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;hits.length();&nbsp;i++){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;Document&nbsp;document&nbsp;=&nbsp;hits.doc(i);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#160;&#160;&#160;&#160;System.out.println(&#34;File:&nbsp;&#34;&nbsp;+&nbsp;document.get(&#34;path&#34;));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&#160;&#160;&#160;&#160;}<br/>}<br/>&nbsp;<br/><br/><br/>在清单2中，类IndexSearcher的构造函数接受一个类型为Directory的对象，Directory是一个抽象类，它目前有两个子类：FSDirctory和RAMDirectory.&nbsp;我们的程序中传入了一个FSDirctory对象作为其参数，代表了一个存储在磁盘上的索引的位置。构造函数执行完成后，代表了这个IndexSearcher以只读的方式打开了一个索引。然后我们程序构造了一个Term对象，通过这个Term对象，我们指定了要在文档的内容中搜索包含关键词”lucene”的文档。接着利用这个Term对象构造出TermQuery对象并把这个TermQuery对象传入到IndexSearcher的search方法中进行查询，返回的结果保存在Hits对象中。最后我们用了一个循环语句把搜索到的文档的路径都打印了出来。好了，我们的搜索应用程序已经开发完毕，怎么样，利用Lucene开发搜索应用程序是不是很简单。<br/><br/><br/><br/>总结<br/><br/>本文首先介绍了&nbsp;Lucene&nbsp;的一些基本概念，然后开发了一个应用程序演示了利用&nbsp;Lucene&nbsp;建立索引并在该索引上进行搜索的过程。希望本文能够为学习&nbsp;Lucene&nbsp;的读者提供帮助。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=78</link>
			<title><![CDATA[中文全文检索的实现以及一些经验]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,05 Nov 2008 11:35:43 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=78</guid>	
		<description><![CDATA[最近在项目中面临中文全文检索的需求，关键需求如下：<br/>1&nbsp;支持中文、英文字词的全文检索，待检索文本是古文言文。<br/>2&nbsp;全文检索表达式支持：&nbsp;AND,OR,NOT,NEAR,BEFORE&nbsp;运算符，支持()。<br/>3&nbsp;速度要求：400M文本，要求在2-5秒内能够检索完毕。<br/><br/>尝试Lucene以及放弃原因：<br/>在尝试Lucene和不同的中文Analyzer后，终告放弃。<br/>原因如下：<br/>由于待检索文本是古文，中文分词技术无法派上用场。在将分隔存储每个汉字后，发现从Lucene中检索到的文本远远少于关键字实际匹配的文本，这一问题对于较长的检索关键字尤其明显。<br/>因为对于检索准确程度要求很高，故此放弃，但是Lucene出的这个问题的原因尚不清楚，希望能够有人提出解答。<br/><br/><br/>自行实现中文全文检索原理以及方法：<br/>1&nbsp;构建过程，忽略标点符号，自行计算每个汉字在每个文本文件中的偏移量，并保存。<br/>2&nbsp;检索过程，定位每个汉字的偏移量，如果检索表达式中每个汉字的预期偏移量与实际偏移量吻合，则匹配成功。<br/>3&nbsp;采用&nbsp;MappedByteBuffer&nbsp;加快检索速度，采用二分查找加快偏移量匹配速度，3个左右的关键字复合检索能够在3-5秒内完成匹配（要求操作系统有足够大的缓存）。<br/><br/>全文检索代码示例(TestFullTextQuery.java)：<br/>File&nbsp;storeDir&nbsp;=&nbsp;new&nbsp;File(&#34;C:\\temp\\fulltext\\index&#34;);<br/>StoreSearcher&nbsp;searcher&nbsp;=&nbsp;new&nbsp;StoreSearcher(storeDir);<br/>String&nbsp;str&nbsp;=&nbsp;&#34;大?藏&nbsp;&amp;&nbsp;阿难&#34;;&nbsp;//同时出现&nbsp;&#34;大?藏&#34;&nbsp;和&nbsp;&#34;阿难&#34;，&nbsp;?代表任意字符<br/>searcher.queryBegin(str,&nbsp;true);<br/>while(true){<br/>&nbsp;&nbsp;&nbsp;&nbsp;StoreSearcherResult&nbsp;ssr&nbsp;=&nbsp;searcher.getNextQueryResult();<br/>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;ssr&nbsp;==&nbsp;null&nbsp;){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&#34;ID&nbsp;&#34;+ssr.docId+&#34;:&#34;+ssr.matchedCount);<br/>}<br/>searcher.queryEnd();<br/>searcher.close();<br/><br/>运行结果<br/>ID&nbsp;T01n0001.TXT:320<br/>ID&nbsp;T01n0002.TXT:3<br/>ID&nbsp;T01n0004.TXT:2<br/>ID&nbsp;T01n0005.TXT:202<br/>ID&nbsp;T01n0006.TXT:131<br/>....<br/><br/>附：全文检索表达式举例<br/><br/>关键字中间可以出现?，表明匹配任意字符。<br/><br/>运算符名称：运算符字符<br/>AND:&amp;<br/>o&#114;:,<br/>BEFORE:*<br/>NEAR:+<br/>NOT:-<br/><br/>表达式举例：<br/>(KEY1&nbsp;&lt;AND|OR|BEFORE|NEAR&gt;&nbsp;KEY2)&nbsp;&amp;&nbsp;(NOT&nbsp;KEY3)<br/>KEY1&nbsp;KEY2&nbsp;(关键字之间无运算符假设为AND)<br/><br/><br/><br/>附：全文检索文件格式信息<br/><br/>DocInfoStore(文档信息)<br/>--HEAD--<br/>DocCount:Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文档数目<br/>--DOC&nbsp;HEAD(PER&nbsp;DOC)--<br/>DocSeq:&nbsp;&nbsp;&nbsp;&nbsp;Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文档顺序号，内部使用<br/>DocId:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Char[128]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文档唯一ID，字符串格式<br/>DocSepOfs:&nbsp;Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文档分隔符数组的Ofs<br/>--DOC&nbsp;SEP&nbsp;OFS(PER&nbsp;DOC)--<br/>DocOfs:&nbsp;&nbsp;&nbsp;&nbsp;ArrayOfInteger&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文档分隔数组<br/><br/><br/>WordInfoStore(每个汉字信息)<br/>--HEAD--<br/>WordCount:Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉字数<br/>--WORD&nbsp;IDX(Per&nbsp;Word)--<br/>WordChar:Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉字的Unicode值<br/>WordInfoOfs:Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉字信息在文件中的偏移量<br/>WordInfoSize:Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉字信息大小<br/>--WORD&nbsp;INFO(Per&nbsp;Word)--<br/>DocCount:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;汉字出现的文档数<br/>DocSeq(Per&nbsp;Doc):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;每个文档的顺序号<br/>WordInDocs:ArrayOfInteger&nbsp;每个文档中出现的汉字的偏移数组，从小到大排列<br/><br/>源码下载地址:<a href="http://www.blogjava.net/Files/zhugf000/foreader2_ftsearch.zip" target="_blank">http://www.blogjava.net/Files/zhugf000/foreader2_ftsearch.zip</a>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=77</link>
			<title><![CDATA[浅谈图片搜索引擎的实现]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,15 Oct 2008 17:34:20 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=77</guid>	
		<description><![CDATA[&nbsp;leo在他的《博客营销》中说不清楚全文检索博客的领域是什么,呵呵，整个Minidx.com其实都只不过是一个自己随便涂鸦的地方，倒还真没考虑过什么领域，更加没有考虑过自己的博客应该专注于哪一方面……如果非要划分，大概<a href="http://minidx.com" target="_blank">http://minidx.com</a>勉强还能算得上一点“领域”吧。呵呵，无所谓了，随便涂鸦吧……OODA&nbsp;SAN说他在研究图片搜索引擎，所以就和他探讨了一些图片搜索的实现的问题，这里也记录一下自己的思路，OODA是这方面的专家，而我只能算是“新手上路”，下面说的有什么不对的还望包涵指出，：）<br/><br/>简单的说，图片搜索是搜索引擎针对网络上的图片所提供的服务。包括Google,&nbsp;Yahoo!,&nbsp;Ask,&nbsp;MSN和AOL以及国内的Baidu这些大型搜索引擎都提供有图片搜索，还有号称图片搜索专用的picsearch，但它们并非真正地对文件中的图像进行搜索，而是对附加在图片中的文字（比如img标签的alt属性）以及文件名进行搜索，也就是通常意义上的关键字索引，所以实质上用的还是基于文本内容的检索，因此也只能搜索数量较少的文件，IBM&nbsp;公司的研究人员也曾经开发一种名为Marvel的可以实现音像资料搜索的搜索引擎，它能够获取目前在互联网上很难获取的音像资料，只是没有关注过目前的进展。目前微软也正在研究可以通过头像来查找某人的信息这样的搜索引擎，微软将之成为Photo2Search，“a&nbsp;picture&nbsp;is&nbsp;worth&nbsp;a&nbsp;thousand&nbsp;words”，真正意义上的多媒体搜索引擎的实现，带给人们的影响，将可以与蒸汽机，电脑相媲美……<br/><br/><br/>也许有人不明白图片搜索能给我们带来什么<br/><br/>当你看到了一种植物，但是不知道叫什么名字及其相关信息……<br/><br/>当你有一张某酒店的照片但是不知道这一酒店的信息……<br/><br/>当你看到某张照片上美丽的风光是你很向往的但是却偏偏没有相关的介绍……<br/><br/>当摄像头拍下了某“坏蛋”的面孔但是却没有人认识这个人……<br/><br/>当你看到上面的美女却压根找不到一点相关的信息……<br/><br/>对于这些问题，用google的图片搜索，可以吗？baidu能够告诉你答案吗？虽然Google&nbsp;图片搜索的时候，在搜索结果页面的网址后面加入&amp;imgtype=face这个参数，即可将图片类型限定为人脸，但是很显然，这样的技术并不能帮助我们解决上面那些问题。而这些需求却是一直都存在的，那么能够帮我们解决这些问题的真正意义上的多媒体（注：不仅仅是图片，其实包括声音文件，影像文件等）搜索引擎应该如何去实现？下面是我所能想到的几种方案<br/><br/>●统一多媒体文件的存储格式。不管是BMP,JPG,GIF……还是MP3,RM，AVI……在生成这样的文件的时候都必须添加必要的文本信息，以特有的结构体存储。这样输入一张图片进行查询的时候，搜索引擎需要的只不过是去解析这一图片的信息，抽取关键字进行查询就可以了。但是，这个世界，是没有想象中那么理想的，否则也不会存在中文，英文，法语，日语……也不会有东方神仙与西方大神了……要制定这样的标准，不是google，yahoo这样的公司可以做到的，也不是美国，中国可以做到的。所以这只能说是镜中水月……无法实现的，就当时我心中的一个美丽的肥皂泡吧。<br/><br/>●提取事物特有的信息对搜索引擎进行训练。研究过搜索引擎的朋友们应该知道，中文分词不同于英文分词，英文可以按照空格来划分单词，但是中文却是连成一片的。所以为了提高中文分词的准确率，通常会准备大量的语料对其进行训练。而有用3D&nbsp;Max之类工具建模经验的朋友们应该知道，在构造某一事物的时候，最先需要对这一事物的特征进行分析，确定好坐标，然后进行构造。不管后面用什么场景来渲染，所建的模都是一样的。比如茶壶，有自己特有的曲线，还有人的脸，一些坐标是相对固定的，不管这个人是年轻，还是变老，这些特征都是无法改变的。所以如果可以采集到足够的“语料”，对搜索引擎进行训练，那么随着训练的进行，搜索引擎认识的东西也就不断的增加，能够提供给我们的信息帮助我们解决的问题也就越来越多。这个和早期的文本搜索引擎应该是一样的。<br/><br/>●对多媒体文件的内容进行分析索引。这种方式是OODA告诉我他正在研究的，大体思路是这样的，比如BMP位图，实际上是以比特流，也就是位的方式存储的，某一类物质，比如说rose，实际上内部的很多比特流都是有一定特征的，这个和通常意义上的文本分类很像，先根据大的特征进行大的分类，然后范围逐步缩小，最终确定目标。不过这个所需要的知识面太过于广泛，至少我无法分析出两张rose图片的相似比特流，希望OODA能够带来一个惊喜吧。<br/><br/>各大搜索引擎公司目前都在投入大量的资金研究这样的搜索引擎，我的Minidx是基于文本的搜索引擎，而我本身对图片之类的比较“白痴”，所以也只能写这么些废话，来贻笑大方了。：）]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=76</link>
			<title><![CDATA[搜索引擎之排序技术分析]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Wed,15 Oct 2008 17:25:38 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=76</guid>	
		<description><![CDATA[什么是排序技术<br/><br/>所谓的排序技术，我们可以简单的理解为曝光率，谁出现的次数最多，谁排在前面。要谈到排序技术，就不得不说Google的PageRank，而提到PageRank，则我们需要先来了解一下一种称为HillTop的排序算法。<br/><br/><br/>PageRank技术：通过对由超过&nbsp;50,000&nbsp;万个变量和&nbsp;20&nbsp;亿个词汇组成的方程进行计算，PageRank能够对网页的重要性做出客观的评价。PageRank&nbsp;并不计算直接链接的数量，而是将从网页&nbsp;A&nbsp;指向网页&nbsp;B&nbsp;的链接解释为由网页&nbsp;A&nbsp;对网页B&nbsp;所投的一票。这样，PageRank&nbsp;会根据网页&nbsp;B&nbsp;所收到的投票数量来评估该页的重要性。&nbsp;<br/><br/>PageRank的思想，链接的重要度整体加重了网站的权重，而网站的权重又反过来影响内部链接的排名。而HillTop算法（也被称为“专家系统”，由Krishna&nbsp;Bharat和George&nbsp;A.&nbsp;Mihaila提出），则是以Dan&nbsp;Thiesw为首的TSPR(Topic-Sensitive-PageRank：主题性页面级别技术)理论。相比PageRank算法，HillTop更强调了内容的相关性，也就是我们常说的“粘性”，“黏度”，而非网站权重，这样避免了可能转贴的权重较高的站点（比如门户站点）比原创作者站点排名还要靠前的问题。那么，到底<br/><br/>什么是Hilltop算法&nbsp;<br/><br/>Bharat提出：在利用”页面等级”来寻找”权威”网页时，不应单纯依赖于值的大小来定夺，而应将重点放在它与查询主题的相关性上；即不但需要考虑网页的页面等级，还要考虑该网页的页面等级与查询主题的相关性是否相称。若一个网页只与查询主题只沾点边，那么即使其页面等级非常之高，对用户来说也是没有意义的。如此一来，于网页而言，那些来自于”相关主题”的文档的链接就更有意义了&nbsp;(Bharat称这种”相关主题”文档为”专家文档”)，一个网页的所有外部”专家文档”链接构成了该网页的”权威性值”。Hilltop算法的意义在于：相同主题网站之间的链接应比非相关网站的链接具有更高的价值。&nbsp;<br/><br/>其实GOOLE早在几年前已经开始混合使用HiilTop和PageRank算法共同确定搜索结果排名了，通过HiilTop的方法，计算来自描述相同主题的相关文档的链接对于搜索者的价值会更大（即相同主题网站之间的链接比不相关网站的链接价值要更大），正是由于HiilTop的影响，这也是我们看到即使各项指标（被收录链接数量，反向链接，访问量等）都非常不错的门户类网站PR很难达到7以上，而专业性的站点却非常容易就达到7，甚至有一大批的都达到了9（注：这里的PR指的是Google综合结果通过Google&nbsp;工具条显示的结果，而并非上面的PageRank值）。<br/><br/>Hilltop算法的不足&nbsp;<br/><br/>●Hilltop的前提是每个专家文件都是完全公正的，且无欺骗和人工操纵成分。专家文件的一个小小污点就可以对排名产生极大的负面影响。&nbsp;<br/><br/>●运行Hilltop算法需要大量的计算机处理能力，像Google的成千上万台服务器集群可以轻松的实现，但是对于一般的企业级用户，服务器就未必具有这样的处理能力。&nbsp;<br/><br/>排名所采用的相关技术&nbsp;<br/><br/>●词干技术(stemming)&nbsp;<br/><br/>Google等各搜索引擎中，目前都已经采用了词干技术(stemming)&nbsp;。最早的搜索引擎，如果搜索一个单数查询条件如”live”，则搜索结果中不会出现如”lives”，”living”这样的关键词变化形式，反之亦然。对于搜索引擎的用户来说，这种特性是一件好事情，因为搜索提供的结果更多了，但站在搜索引擎商业用户来说，那就意味着需要多购买一些关键词，这个也体现了技术的进步在商业中的价值。&nbsp;<br/><br/>●拼写纠错&nbsp;<br/><br/>拼写检查和上面的词干技术一样，也已经被应用于搜索结果中。例如，当输入查询条件为”Search&nbsp;Engine&nbsp;Optimisation”后，以往Google只会提示你是否是要找”Search&nbsp;Engine&nbsp;Optimization”，但显示的还是符合”Optimisation”的搜索结果。不过现在则能看到”Optimization”的搜索结果。&nbsp;<br/><br/>这两项处理其实都是在分词阶段完成的。&nbsp;&nbsp;<br/><br/>排名的商业价值<br/><br/>排名在商业中的价值，在互联网蓬勃发展的今天，已经得到了充分的体现。2003年Google大规模调整算法的时候就引来了种种传言和猜测&nbsp;：&nbsp;<br/><br/>开始使用词典对号入座；&nbsp;<br/>意图施压使商业站点使用Adwords广告服务；&nbsp;<br/>开始使用”基于贝叶斯定理的SPAM过滤系统”&nbsp;；&nbsp;<br/>开始处罚互惠链接，”优化”网页，或”链接文本”&nbsp;；&nbsp;<br/>众多猜测中，”Google意图施压使商业站点使用Adwords广告服务”显然占了上风。许多搜索引擎优化分析家都认为：Google通过一个保密的过滤系统”黑名单”来对商业网站进行筛选，从而达到上述目的。虽然这都紧紧是一些猜测，但是这样的传言和猜测，恰恰反应了排名的重要商业价值。<br/>参考资料：<br/>・The&nbsp;Google&nbsp;Hilltop&nbsp;Algorithm<br/><a href="http://www.rankforsales.com/search-engine-algorithms/google-hilltop-algorithm.html" target="_blank">http://www.rankforsales.com/search-engine-algorithms/google-hilltop-algorithm.html</a><br/>・Hilltop:&nbsp;A&nbsp;Search&nbsp;Engine&nbsp;based&nbsp;on&nbsp;Expert&nbsp;Documents<br/><a href="ftp://ftp.cs.toronto.edu/pub/reports/csri/405/hilltop.html" target="_blank">ftp://ftp.cs.toronto.edu/pub/reports/csri/405/hilltop.html</a>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=75</link>
			<title><![CDATA[使用Netbeans开发搜索引擎Nutch]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,15 Oct 2008 17:04:44 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=75</guid>	
		<description><![CDATA[　Nutch简介&nbsp;<br/><br/>　　Nutch&nbsp;是一个开源的、Java&nbsp;实现的搜索引擎。它提供了我们运行自己的搜索引擎所需的全部工具。Nutch致力于让每个人能很容易,&nbsp;同时花费很少就可以配置世界一流的Web搜索引擎.&nbsp;为了完成这一宏伟的目标,&nbsp;nutch能够做到:&nbsp;每个月取几十亿网页;&nbsp;为这些网页维护一个索引;&nbsp;对索引文件进行每秒上千次的搜索;&nbsp;提供高质量的搜索结果;&nbsp;以最小的成本运作.&nbsp;<br/><br/>　　测试环境：&nbsp;<br/><br/>　　Nutch&nbsp;release&nbsp;0.9&nbsp;<br/><br/>　　Netbean5.5.1&nbsp;中文版&nbsp;<br/><br/>　　Java&nbsp;1.6&nbsp;<br/><br/>　　Ubuntu&nbsp;7.10&nbsp;<br/><br/>　　步骤:&nbsp;<br/><br/>　　1.安装：Nutch&nbsp;<br/><br/>　　下载&nbsp;Nutch&nbsp;0.9&nbsp;的压缩包并解压&nbsp;<br/><br/>　　（下载地址：<a href="http://apache.mirror.phpchina.com/lucene/nutch/" target="_blank">http://apache.mirror.phpchina.com/lucene/nutch/</a>）&nbsp;<br/><br/>　　按照教程进行安装&nbsp;<br/><br/>　　(教程地址:&nbsp;<a href="http://wiki.apache.org/nutch/NutchTutorial" target="_blank">http://wiki.apache.org/nutch/NutchTutorial</a>)&nbsp;<br/><br/>　　2.在Netbeans中创建项目&nbsp;<br/><br/>　　启动Netbeans5.5.1；&nbsp;<br/><br/>　　创建过程：文件-＞新建项目-＞常规；&nbsp;<br/><br/>　　选择“基于现有源代码的Java项目”-＞下一步，选择项目名称和项目文件夹，可以根据自己的需要自行指定；&nbsp;<br/><br/>　　选择下一步，点击“源包文件夹”文本框右边的“添加文件夹”按钮，浏览文件目录选择Nutch安装目录下的src文件夹；&nbsp;<br/><br/>　　点击完成，此时工程已经建立，当需要对项目进行配置才能实现代码的调试；&nbsp;<br/><br/>　　在左边的“项目”导航窗口中，选择库包，点击右键，选择属性，此时弹出项目属性配置窗口&nbsp;<br/><br/>　　选择配置“库”，点击按钮“添加JAR/文件夹”，添加Nutch安装目录下的&nbsp;&#34;conf&#34;目录以及nutch-0.9.jar包；&nbsp;<br/><br/>　　继续将Nutch安装目录下“lib”和“plugin”文件夹中的所有JAR包添加进来，此处比较麻烦，因为Netbeans不能自动扫描到文件夹下所有的JAR包，必须手工将其添加进来。&nbsp;<br/><br/>　　最后需要添加两个JAR包，这两个包分别是解析MP3和RTF文档的，因为license的不兼容性，它们从代码中分离了，你可以在如下地址下载：&nbsp;<br/><br/><a href="http://nutch.cvs.sourceforge.net/nutch/nutch/src/plugin/parse-mp3/lib/" target="_blank">http://nutch.cvs.sourceforge.net/nutch/nutch/src/plugin/parse-mp3/lib/</a>&nbsp;<br/><br/><a href="http://nutch.cvs.sourceforge.net/nutch/nutch/src/plugin/parse-rtf/lib/" target="_blank">http://nutch.cvs.sourceforge.net/nutch/nutch/src/plugin/parse-rtf/lib/</a>&nbsp;<br/><br/>　　下载后将其分别放至src/plugin/parse-mp3/lib和src/plugin/parse-rtf/lib/目录下，同时像添加其他JAR包一样，将其添加至“编译时库”中。此时，您可以选择左方“项目”导航窗口中的项目图标，点击右键，选择“生成项目”，项目应该能正确通过编译。您还需要对Nutch进行配置以调试Nutch的爬行代码。&nbsp;<br/><br/>　　3.配置&nbsp;Nutch&nbsp;<br/><br/>　　在Nutch安装目录下，找到文件/conf/nutch-defaul.xml，&nbsp;将其&nbsp;&#34;plugin.folders&#34;&nbsp;属性值改为&#34;Nutch安装目录/src/plugin&#34;&nbsp;<br/><br/>　　4.在Nutch中运行Nutch爬虫&nbsp;<br/><br/>　　选择左方“项目”导航窗口中的项目图标，点击右键，选择“属性”，在左方类别窗口中选择“运行”，对运行参数进行配置&nbsp;<br/><br/>　　主类：&nbsp;选择&nbsp;o&#114;g.apache.nutch.crawl.Crawl&nbsp;<br/><br/>　　参数：&nbsp;填入&nbsp;urls&nbsp;-dir&nbsp;crawl&nbsp;-depth&nbsp;3&nbsp;-topN&nbsp;50&nbsp;<br/><br/>　　VM选项：填入&nbsp;-Dhadoop.log.dir=logs&nbsp;-Dhadoop.log.file=hadoop.log&nbsp;<br/><br/>　　点击“确定”按钮退出&nbsp;<br/><br/>　　选择左方“项目”导航窗口中的项目图标，点击右键，选择“运行项目”&nbsp;<br/><br/>　　注:对于Ubuntu来说，可能由于权限的问题导致不能正常调试，可以在用户和组管理中设置当前用户的组为ROOT组。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=74</link>
			<title><![CDATA[基于Lucene/XML的站内全文检索解决方案：WebLucene]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 16:52:08 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=74</guid>	
		<description><![CDATA[内容摘要：<br/>为Lucene做一个通用XML接口一直是我最大的心愿：更方便的在WEB应用中嵌入全文检索功能<br/><br/>提供了XML的数据输入接口：适合将原有基于各种数据库的数据源导入到全文索引中，保证了数据源的平台无关性；&nbsp;<br/>通过了基于XML的搜索结果输出：方便了通过XSLT进行前台的结果显示；&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;MySQL&nbsp;&nbsp;\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;JSP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;o&#114;acle&nbsp;-&nbsp;DB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;==&gt;&nbsp;&nbsp;&nbsp;XML&nbsp;==&gt;&nbsp;(Lucene&nbsp;Index)&nbsp;==&gt;&nbsp;XML&nbsp;&nbsp;-&nbsp;&nbsp;ASP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MSSQL&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;PHP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MS&nbsp;Word&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;XHTML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PDF&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=XSLT=&gt;&nbsp;-&nbsp;&nbsp;TEXT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\&nbsp;XML&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_________WebLucene__________/&nbsp;使用过程如下：将数据用脚本导出成XML格式；&nbsp;<br/>将XML数据源导入LUCENE索引；&nbsp;<br/>从WEB界面得到XML结果输出，并通过XSLT生成HTML页面<br/><br/>站内全文检索的必要性<br/>虽然大型搜索引擎的功能已经越来越强大了，很多站点都使用了Google的站内检索site:domain.com代替了自己的站内数据库“全文”检索。&nbsp;但依靠GOOGLE这样的大型搜索引擎做站内检索会有以下弊端：<br/><br/>数量有限：搜索引擎并不会深度遍历一个网站，而将网站所有的内容都索引进去，比如Google就喜欢静态网页，而且是最新更新的，而不喜欢带?的动态网页，Google甚至会定期将缺少入口的网站内容逐渐抛弃；&nbsp;<br/>更新慢：搜索引擎针对站点的更新频率也是有一定周期的，很多内容需要一定时间后才能进入GOOGLE的索引：目前Google&nbsp;Dance的周期是21天左右；&nbsp;<br/>内容不精确：搜索引擎需要通过页面内容提取技术将导航条，页头页尾等内容过滤掉，反而不如直接从后台数据库提取数据来得直接，这种摘要和排重机制是很难实现的；&nbsp;<br/>无法控制输出：也许有更多的输出需求，按时间排序，按价格，按点击量，按类目过滤等&nbsp;<br/>系统的搭建<br/>下载：<br/><a href="http://sourceforge.net/projects/weblucene/" target="_blank">http://sourceforge.net/projects/weblucene/</a><br/><br/>XML数据源的导入：<br/><br/>只要数据源可以导出成3层的XML结构，就都可以用IndexRunner这个命令行工具导入：<br/><br/>比如从数据库导出：news_dump.xml<br/>&lt;?xml&nbsp;version=&#34;1.0&#34;&nbsp;encoding=&#34;GB2312&#34;?&gt;<br/>&lt;Table&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;Record&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Title&gt;标题&lt;/Title&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Author&gt;作者&lt;/Author&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Content&gt;内容&lt;/Content&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;PubTime&gt;2003-06-29&lt;/PubTime&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Record&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;Record&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Title&gt;My&nbsp;Title&lt;/Title&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Author&gt;chedong&lt;/Author&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Content&gt;abc&lt;/Content&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;PubTime&gt;2003-06-30&lt;/PubTime&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Record&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;...<br/>&lt;/Table&gt;<br/><br/>IndexRunner&nbsp;-i&nbsp;news_dump.xml&nbsp;-o&nbsp;c:\index&nbsp;-t&nbsp;Title,Content&nbsp;-n&nbsp;Author&nbsp;<br/>-i&nbsp;news_dump.xml:&nbsp;&nbsp;以news_dump.xml为数据源<br/>-o&nbsp;c:\index&nbsp;&nbsp;&nbsp;索引库建立在c:\index目录下<br/>索引建立Title&nbsp;Author&nbsp;Content&nbsp;PubTime这几个字段外，按以下规则建立索引：<br/>-t&nbsp;Title,Content&nbsp;一个进行分词的全文索引TokenIndex：数据是Title&nbsp;Content这2个字段<br/>-n&nbsp;Author&nbsp;&nbsp;&nbsp;&nbsp;一个不分词的索引：NoTokenIndex：数据源是Author这个字段。<br/><br/>对于RSS数据源：<br/>&lt;?xml&nbsp;version=&#34;1.0&#34;?&gt;<br/>&lt;rss&nbsp;version=&#34;0.92&#34;&gt;<br/>&lt;channel&gt;<br/>&nbsp;&nbsp;&lt;title&gt;Amazon:&nbsp;Books&nbsp;Arts&nbsp;&amp;amp;&nbsp;Photography&lt;/title&gt;<br/>&nbsp;&nbsp;&lt;link&gt;<a href="http://www.lockergnome.com/" target="_blank">http://www.lockergnome.com/</a>&lt;/link&gt;<br/>&nbsp;&nbsp;&lt;description&gt;Amazon&nbsp;RSS&nbsp;Feed&lt;/description&gt;<br/>&nbsp;&nbsp;&lt;lastBuildDate&gt;Sun,&nbsp;29&nbsp;Jun&nbsp;2003&nbsp;01:05:01&nbsp;GMT&lt;/lastBuildDate&gt;<br/>&nbsp;&nbsp;&lt;docs&gt;<a href="http://www.lockergnome.com/" target="_blank">http://www.lockergnome.com/</a>&lt;/docs&gt;<br/>&nbsp;&nbsp;&lt;webMaster&gt;amazonfeed@lockergnome.com&nbsp;(Lockergnome&nbsp;RSS&nbsp;Generator)&lt;/webMaster&gt;<br/>&nbsp;&nbsp;&lt;item&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;The&nbsp;Artist&#39;s&nbsp;Way:&nbsp;A&nbsp;Spiritual&nbsp;Path&nbsp;to&nbsp;Higher&nbsp;Creativity&nbsp;-&nbsp;$11.17&lt;/title&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;link&gt;<a href="http://www.amazon.com/exec/obidos/ASIN/1585421464/lockergnomedigit/?ref=nosim" target="_blank">http://www.amazon.com/exec/obidos/ASIN/1585421464/lockergnomedigit/?ref=nosim</a>&amp;amp;dev-it=D34HUVGKB34YFX&lt;/link&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;<a href="http://www.lockergnome.com/" target="_blank">http://www.lockergnome.com/</a>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/description&gt;<br/>&nbsp;&nbsp;&lt;/item&gt;<br/>&nbsp;&nbsp;...<br/>&lt;/channel&gt;<br/><br/>IndexRunner&nbsp;-i&nbsp;<a href="http://www.example.com/rss.xml" target="_blank">http://www.example.com/rss.xml</a>&nbsp;-o&nbsp;c:\index&nbsp;-t&nbsp;title,description&nbsp;-n&nbsp;link&nbsp;&nbsp;-l&nbsp;&nbsp;4<br/>-l&nbsp;4&nbsp;表示拿第4层节点作为字段映射，<br/><br/>IndexRunner还提供了-a&nbsp;-m这两个选项：用于增量索引和批量索引优化。<br/>-a&nbsp;&nbsp;增量索引，表示在原有索引的基础上扩展<br/>-m&nbsp;&nbsp;mergeFactor&nbsp;在Lucene中mergeFactor是一个针对批量索引的优化参数，控制多少条处理完多少条记录（Document）后，写入一次索引，写入频率越高，内存使用越少，但索引速度越慢，所以在大批量数据导入时需要增大文件写入的间隔，多让索引在内存中操作。<br/><br/>搜索结果输出：<br/><br/><br/>以下是系统设计过程中一些设计的思路：<br/><br/>做为工业标准的XML<br/>记得以前有关于肯德基的炸薯条断顿的报道。从这个事件报道中我们可以看到一种更高效的管理体系：对于快餐店这样全球性的企业来说，要保证各地提供的薯条品质，成本最低的方法肯定是依靠机器而不是厨师，如果要求薯条机能够处理各种形状不一的土豆，机器的复杂程度和维护成本都会很高。所以土豆必须严格符合工业标准才能让结构比较简单的薯条机生产出符合标准的薯条，因此，薯条的加工机械会严格按照土豆协会的土豆工业标准设计。高质量的原料可以大大降低后期加工设备的成本，因此从总体成本上讲还是合算的。&nbsp;<br/>对于软件应用开发者来说：应用和应用之间，企业和企业之间交换的数据好比就是土豆，白菜，按照严格的XML标准设计的接口作为企业之间后台数据交换的工业标准，虽然不如简单的CSV格式高效，但缺能大大简化下游工序的后期加工成本。<br/><br/><br/>不难想象为什么处理HTML的浏览器：IE和Mozilla等浏览器软件大小都在10M以上，但一般处理XML的解析器一般都在几百K。除了没有界面外，HTML浏览器需要为太多不规范的HTML代码提供大量容错处理也是一个很重要的原因，而语法严格，规则简单的XML处理器就可以做的很简短，高效，体积越“小”就意味着适应性越广：这点在手机这样的硬件配置比较低的设备环境中显得尤其重要。<br/><br/>虽然XML在后台数据交换方面，有着巨大的潜力。在前台表现方面，XML并不会马上代替HTML，很多通过XSLT输出的HTML仍然需要结合CSS来进行表现。XML&nbsp;==XSLT==&gt;&nbsp;HTML&nbsp;+&nbsp;CSS。但是由于太多的网页都是用HTML做的，相信XML没有必要马上代替这些已有的机制。<br/><br/>此外在应用的国际化支持方面XML和Java简直是绝配：XML数据源用Java解析后是UNICODE，这样无论是日文，繁体中文还是德文的内容我们都可以在一个索引库中同时进行搜索。这样针对其他语言的支持只是设计各种语言界面的问题了。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GBK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/&nbsp;BIG5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BIG5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;UNICODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;====&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unicode&nbsp;-&nbsp;&nbsp;GB2312&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SJIS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;(XML)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(XML)&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;SJIS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ISO-8859-1&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\&nbsp;ISO-8859-1使用XML的另外一个额外好处在于：开发人员一般都没有仔细理解Java的字符集（其实上是JVM的缺省file.encoding属性）受系统本地化设置的影响，基于XML的输入使得数据的字符解码过程变得透明：不用再和用户解释需要如何解码，编码数据源。不过，XML的学习成本还是比较高的，假设你HTML的学习成本是1，XML则可能为10，而XSLT的学习成本则可能高达100。<br/><br/>传统数据库应用的全文检索加速<br/>让数据库负责精确匹配，将模糊匹配用独立的系统实现<br/>一个站点内容积累在万级以上，站内全文检索就会是用户定位最主要的手段，而关键词检索是用户最熟悉的方法。因此基于数据库的传统WEB应用在全文检索需求还是很大的。<br/><br/>但是可怕的%like%数据库操作可能会吃掉数据库服务器90%以上的CPU。Oracle&nbsp;MSSQL等数据库服务器中数据库内置的全文检索基本上都不太适合WEB应用。而数据库另外一个的弊端在于对于条件简单的查询返回结果集非常大：数据库并不知道如何面向用户最关心的的头100条结果进行优化。根据以前的统计：头100条结果往往已经可以满足95％以上用户需求。<br/><br/>需要缓存设计：根据我们的经验，在应用设计中没有必要进行内置的结果缓存设计：让前台的应用服务器内置的缓存机制或者反相代理缓存服务器进行缓存就够了。<br/><br/>数据同步策略<br/>总体上讲，全文检索和数据库其实是2种根本不同的应用模式，全文检索系统其实往往也没有必要和数据库那么高的实时同步机制，如果按照：低更新，高缓存的模式进行设计：数据库数据到全文索引的同步过程一般都可以通过脚本定期将数据库的数据导出成XML，然后进入Lucene的全文索引。而针对原有数据记录的更新和删除，其实一般可以通过定期的重建索引解决。WebLucene其中索引部分是一个IndexRunner的命令行程序实现的。<br/><br/>结果排序策略<br/>站内全文索引另外一个很重要的需求是可定制的排序：按时间，按价格，按点击量……Lucene全文索引缺省只提供了根据关键词在原文中的匹配度排序，而任何根据某个字段的值进行排序的都无法避免再次遍历数据，从而导致性能有数量级的下降（等于又是做%Like%检索），而在索引中，除了匹配度SCORE外，唯一能用来排序的就是索引记录的ID，所以一个比较高效率实现定制排序的方法时：在索引时，让进入Lucene全文的顺序对应着一定规则：比如时间，然后在搜索时，让搜索结果按照索引记录的ID进行排序（或倒排）。<br/><br/>搜索结果关键词标引的实现<br/>搜索结果中关键词通过红色或者黑体字标记出来，为了能够更恰当的显示相关上下文的问题，标引是通过限制了一个扫描范围，然后根据一个分析器将指定的词流式的读取出来，然后<br/><br/>全文检索和其他应用的集成<br/>其实核心的是一个Lucene的XML接口：SAX方式的数据导入和DOM方式的结果输出。<br/><br/>XML的数据源定义：<br/>只要是能够映射成表＝》记录＝》字段这样层次结构的都可以。因此WebLucene索引的设计比较灵活，甚至可以直接用来索引RSS。<br/><br/>XML结果定义：参考了Google的XML接口的设计<br/><br/>如果没有SERVLET界面，提供XML输出的DOMSearcher也可以很方便集成到各种应用系统中。<br/><br/><br/>参考资料：<br/><br/>系统设计中使用的一些模块：<br/><br/><br/>Jakarta&nbsp;Lucene:&nbsp;<a href="http://jakarta.apache.org/lucene/" target="_blank">http://jakarta.apache.org/lucene/</a><br/>Xerces&nbsp;/&nbsp;Xalan&nbsp;<a href="http://xml.apache.org/" target="_blank">http://xml.apache.org/</a><br/><br/>Log4j&nbsp;<a href="http://jakarta.apache.org/log4j/" target="_blank">http://jakarta.apache.org/log4j/</a><br/><br/>Google的XML接口定义：&nbsp;<a href="http://www.google.com/google.dtd" target="_blank">http://www.google.com/google.dtd</a><br/>其他开发人员的一些反馈和改进<br/><br/>将WebLucene中的lucene部分升级到2.1<br/>WebLucene安装实习篇&nbsp;<br/>WebLucene的安装经验<br/>银杏咨询：&nbsp;站内搜索引擎提供商，为点评，饭统网提供了站内全文检索服务；&nbsp;]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=73</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(7)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 15:22:05 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=73</guid>	
		<description><![CDATA[五、全文检索性能考量<br/><br/>除了硬件资源&nbsp;[如内存（3GB&nbsp;限制）、磁盘速度和&nbsp;CPU&nbsp;速度]&nbsp;以外，全文搜索性能还受到&nbsp;Microsoft&nbsp;SQL&nbsp;Server&nbsp;和&nbsp;Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;for&nbsp;SQL&nbsp;Server&nbsp;(MSFTESQL)&nbsp;服务对这些资源的争用情况的影响。MSFTESQL&nbsp;服务只对磁盘进行写操作，而&nbsp;SQL&nbsp;Server&nbsp;会对磁盘进行读写操作。从性能角度出发，关键是很好地优化&nbsp;MSFTESQL&nbsp;服务，以便获得最佳使用效果。<br/><br/>全文搜索性能包含两个方面：<br/><br/>◆全文索引性能<br/>◆全文查询性能<br/><br/>全文索引性能<br/><br/>Microsoft&nbsp;SQL&nbsp;Server&nbsp;2005&nbsp;中的全文搜索的索引性能很大程度上取决于下面两个因素：<br/><br/>◆SQL&nbsp;Server&nbsp;创建全文批花费的时间。<br/>◆MSFTESQL&nbsp;服务使用这些批的速度。<br/><br/>若要达到最佳性能，需要优化&nbsp;SQL&nbsp;Server&nbsp;与&nbsp;MSFTESQL&nbsp;服务之间的交互。如果&nbsp;MSFTESQL&nbsp;服务处理不完&nbsp;SQL&nbsp;Server&nbsp;生成的批，该服务将暂停，并生成一个爬网日志消息来指示此暂停状态。有关如何解决此问题的信息，请参阅Microsoft&nbsp;SQL&nbsp;Server&nbsp;全文引擎&nbsp;(MSFTESQL)&nbsp;服务已暂停。<br/><br/>另一方面，如果&nbsp;SQL&nbsp;Server&nbsp;没有生成足够的全文批,&nbsp;使&nbsp;MSFTESQL&nbsp;服务充分运行，该服务就会闲置，这样就不能达到最佳性能。若要确保&nbsp;MSFTESQL&nbsp;服务处于最佳使用状况，需要跟踪并优化下列计数器：<br/><br/>正在处理的批计数器&nbsp;-&nbsp;Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;Filter&nbsp;Daemon&nbsp;(MSFTELFD)<br/><br/>此计数器应当等于系统中的&nbsp;CPU&nbsp;数或其两倍。当&nbsp;CPU&nbsp;使用值为&nbsp;0、1&nbsp;或&nbsp;2&nbsp;时，指示&nbsp;SQL&nbsp;Server&nbsp;执行情况不好。例如，如果计算机上具有&nbsp;4&nbsp;个&nbsp;CPU，此数值就应该为&nbsp;4&nbsp;或&nbsp;8。<br/><br/>已就绪的批队列&nbsp;-&nbsp;MSFTESQL&nbsp;服务<br/><br/>如果批数较少，可以执行下列操作：<br/><br/>◆增加全文批的大小。<br/>◆确保基表具有聚集索引。<br/>◆将&nbsp;SQL&nbsp;日志、数据库文件和全文目录分别放在单独的磁盘上。<br/>◆默认情况下，全文批的大小是每批&nbsp;1600&nbsp;行。如果计算机上有八个频率为&nbsp;700Mhz&nbsp;的&nbsp;CPU，推荐采用的批大小为&nbsp;5000&nbsp;行。<br/><br/>注意：&nbsp;&nbsp;<br/><br/>增加批大小会导致批的生成速度变慢，而且&nbsp;MSFTSQL&nbsp;要执行更多的操作来处理每个批。此外，请记住全文批的大小受共享内存区域大小的限制。共享内存区域大小的默认值为&nbsp;4Mb。<br/><br/>爬网范围&nbsp;<br/><br/>◆使用&nbsp;sp_configure&nbsp;最大全文爬网范围选项增大爬网范围计数器。理想情况下，此值应该是&nbsp;CPU&nbsp;数的两倍。<br/>◆使用&nbsp;Up&#100;ate&nbsp;STATISTICS&nbsp;语句更新基表的统计信息。&nbsp;<br/><br/>提高全文查询性能的建议<br/><br/>下面列出了有助于提高全文查询性能的建议。<br/><br/>使用&nbsp;Alt&#101;r&nbsp;INDEX&nbsp;REORGANIZE&nbsp;对基表的索引进行碎片整理。<br/><br/>使用&nbsp;Alt&#101;r&nbsp;FULLTEXT&nbsp;CATALOG&nbsp;REORGANIZE&nbsp;重新组织全文目录。切记要在进行性能测试之前执行此操作，因为它会引起该目录中全文索引的主合并。<br/><br/>仅选择较小的列作为全文键列。即使支持&nbsp;900&nbsp;字节的列，也不建议您使用这么大的键列来创建全文索引。<br/><br/>将多个&nbsp;CONTAINS&nbsp;合并为一个&nbsp;CONTAIN。在&nbsp;Microsoft&nbsp;SQL&nbsp;Server&nbsp;中，您可以在&nbsp;CONTAINS&nbsp;查询中指定一个包含若干列的列表。<br/><br/>如果只需要全文键或排名的信息，请分别使用&nbsp;CONTAINSTABLE&nbsp;或&nbsp;FREETEXTTABLE，而不要使用&nbsp;CONTAINS&nbsp;或&nbsp;FREETEXT。<br/><br/>使用&nbsp;FREETEXTTABLE&nbsp;和&nbsp;CONTAINSTABLE&nbsp;语法的&nbsp;TOP_N_BY_RANK&nbsp;选项来限制结果数并提高性能。如果您不是对可能查询到的所有信息都感兴趣，可使用此选项。<br/><br/>六、需求规划<br/><br/>我们知道做好网站检索不仅仅面临纯技术的问题，而且本身需要事前的需求规划，这里给出了全网搜索在功能性需求和非功能性需求上的典型需求。<br/><br/>功能性的需求：&nbsp;<br/><br/>（1）哪些业务数据需要提供全文的检索服务？&nbsp;<br/>（2）这些业务数据中那些关键信息是业务人员关心的？&nbsp;<br/>（3）需要支持哪些国家的语言？&nbsp;<br/>（4）有哪些行业术语、常用缩略词、替换词？&nbsp;<br/>（5）需要哪些检索功能，分别基于什么范畴的关键字展开检索？&nbsp;<br/><br/>非功能性的需求：&nbsp;<br/><br/>（1）业务上以前是否尝试过关系数据库查询、多维数据分析解决手头的问题？&nbsp;<br/>（2）检索时效性要求。&nbsp;<br/>（3）习惯的检索操作平台（浏览器&nbsp;/&nbsp;桌面），查询结果的展示方式。&nbsp;<br/>（4）授权控制。&nbsp;<br/>（5）查询结果的导出和发布方式要求。&nbsp;<br/><br/>七、结束语<br/><br/>本文提供了网站如何设计和实现基于SQL&nbsp;Server&nbsp;2005的全文检索实例，希望能对正在使用SQL&nbsp;Server&nbsp;2005构建网站搜索的同仁有所裨益。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=72</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(6)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 15:21:20 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=72</guid>	
		<description><![CDATA[2)建立通用分页存过程[USP_GetFrontDataList_ByFullIndex]。由于性能考虑，返回给前台页面需要网站数据库端即完成分页。<br/><br/>Cr&#101;ate&nbsp;PROCEDURE&nbsp;[dbo].[USP_GetFrontDataList_ByFullIndex](@TableViewQueryName&nbsp;&nbsp;Varchar(&nbsp;1024&nbsp;),&nbsp;&nbsp;&nbsp;--Table或View或者Query的名字或字符串&nbsp;@Key&nbsp;&nbsp;&nbsp;&nbsp;Varchar(&nbsp;50&nbsp;),&nbsp;&nbsp;--关键字&nbsp;@Sel&#101;ctStr&nbsp;&nbsp;&nbsp;Varchar(&nbsp;500&nbsp;),&nbsp;&nbsp;&nbsp;--选择列字符串&nbsp;@Criteria&nbsp;&nbsp;&nbsp;Varchar(&nbsp;8000&nbsp;),--查询条件&nbsp;@Sort&nbsp;&nbsp;&nbsp;&nbsp;Varchar(&nbsp;255&nbsp;),&nbsp;--排序字符串&nbsp;@FristTopNum&nbsp;&nbsp;&nbsp;INT,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--显示的第一页置顶的数目&nbsp;@Page&nbsp;&nbsp;&nbsp;&nbsp;BIGINT&nbsp;&nbsp;OUTPUT,&nbsp;--显示的当前页号&nbsp;@CurrentPageRow&nbsp;&nbsp;BIGINT,&nbsp;&nbsp;--页大小(显示多少行)@TotalCount&nbsp;&nbsp;&nbsp;BIGINT&nbsp;OUTPUT&nbsp;&nbsp;&nbsp;--通过该查询条件，返回的查询记录的总页数&nbsp;)ASSET&nbsp;NOCOUNT&nbsp;ON&nbsp;if&nbsp;charindex(&#39;;&#39;,@Criteria)&gt;0&nbsp;o&#114;&nbsp;charindex(&#39;--&#39;,@Criteria)&gt;0&nbsp;o&#114;&nbsp;charindex(&#39;/*&#39;,@Criteria)&gt;0&nbsp;o&#114;&nbsp;charindex(&#39;*/&#39;,@Criteria)&gt;0&nbsp;o&#114;&nbsp;charindex(&#39;syscolumns&#39;,@Criteria)&gt;0&nbsp;&nbsp;o&#114;&nbsp;charindex(&#39;sysfiles&#39;,@Criteria)&gt;0or&nbsp;charindex(&#39;char(124)&#39;,@Criteria)&gt;0&nbsp;&nbsp;o&#114;&nbsp;charindex(&#39;1=1&#39;,@Criteria)&gt;0&nbsp;RETURN&nbsp;DECLARE&nbsp;@TotalStr&nbsp;&nbsp;nVarchar(4000)DECLARE&nbsp;@Str&nbsp;&nbsp;&nbsp;nVarchar(4000)DECLARE&nbsp;@TopRowNum&nbsp;bigintIF&nbsp;&nbsp;@Sel&#101;ctStr&nbsp;IS&nbsp;NULL&nbsp;ANDRTRIM(LTRIM(@Criteria))&nbsp;=&nbsp;&#39;&#39;SET&nbsp;@Sel&#101;ctStr&nbsp;=&nbsp;&#39;*&#39;IF&nbsp;@FristTopNum&nbsp;IS&nbsp;NULL&nbsp;AND&nbsp;@FristTopNum&nbsp;&lt;&nbsp;0BEGINSET&nbsp;@FristTopNum&nbsp;=&nbsp;0ENDELSE&nbsp;IF&nbsp;@FristTopNum&nbsp;&gt;&nbsp;@CurrentPageRowBEGINSET&nbsp;@FristTopNum&nbsp;=&nbsp;@CurrentPageRowENDIF&nbsp;&nbsp;@CurrentPageRow&nbsp;&gt;&nbsp;0BEGINIF&nbsp;@Criteria&nbsp;IS&nbsp;NOT&nbsp;NULL&nbsp;ANDRTRIM(LTRIM(@Criteria))&nbsp;&lt;&gt;&nbsp;&#39;&#39;BEGINSET&nbsp;&nbsp;@TotalStr&nbsp;=&nbsp;&#39;Sel&#101;ct&nbsp;@TotalCount=COUNT(*)&nbsp;FROM&nbsp;&nbsp;&#39;&nbsp;+&nbsp;&#39;(&#39;+&nbsp;@TableViewQueryName&nbsp;&nbsp;&nbsp;+&#39;)&#39;+&nbsp;&#39;&nbsp;T&nbsp;&#39;+&nbsp;&#39;&nbsp;Wh&#101;re&nbsp;&#39;&nbsp;+&nbsp;@CriteriaENDELSEBEGINSET&nbsp;&nbsp;@TotalStr&nbsp;=&nbsp;&#39;Sel&#101;ct&nbsp;@TotalCount=COUNT(*)&nbsp;FROM&nbsp;&#39;&nbsp;+&nbsp;&#39;(&#39;+@TableViewQueryName&nbsp;&nbsp;+&#39;)&#39;+&nbsp;&#39;&nbsp;T&nbsp;&#39;&nbsp;ENDPRINT&nbsp;@TotalStrEXEC&nbsp;&nbsp;sp_ExecuteSql&nbsp;@TotalStr,&nbsp;N&#39;@TotalCount&nbsp;bigint&nbsp;output&#39;,@TotalCount&nbsp;outputSET&nbsp;@TotalCount&nbsp;=&nbsp;@TotalCount&nbsp;+&nbsp;isnull(@FristTopNum&nbsp;&nbsp;,0)DECLARE&nbsp;@TotalPage&nbsp;bigintSET&nbsp;@TotalPage&nbsp;=&nbsp;@TotalCount/@CurrentPageRowIF&nbsp;@TotalCount%@CurrentPageRow&nbsp;&gt;&nbsp;0BEGINSET&nbsp;@TotalPage&nbsp;=&nbsp;@TotalPage&nbsp;+&nbsp;1END&nbsp;IF&nbsp;@Page&nbsp;&lt;=&nbsp;0&nbsp;BEGINSET&nbsp;@Page&nbsp;=&nbsp;1ENDIF&nbsp;@TotalPage&nbsp;&gt;&nbsp;0&nbsp;AND@Page&nbsp;&gt;&nbsp;@TotalPageBEGINSET&nbsp;@Page&nbsp;=&nbsp;@TotalPageEND&nbsp;--组织查询语句&nbsp;SET&nbsp;&nbsp;@Str&nbsp;=&nbsp;&nbsp;&#39;Sel&#101;ct&nbsp;&nbsp;&nbsp;&#39;&nbsp;+&nbsp;&nbsp;&nbsp;@Sel&#101;ctStr&nbsp;+&nbsp;&#39;&nbsp;FROM&nbsp;(&#39;&nbsp;+&nbsp;&nbsp;@TableViewQueryName&nbsp;&nbsp;+&nbsp;&#39;)&nbsp;T&nbsp;Wh&#101;re&nbsp;&nbsp;T.SerialNumber&nbsp;&gt;&#39;&nbsp;+cast&nbsp;((@Page-1)&nbsp;&nbsp;as&nbsp;varchar(10))&nbsp;+&nbsp;&#39;*&#39;&nbsp;+cast(&nbsp;@CurrentPageRow&nbsp;as&nbsp;varchar(10))+&nbsp;&nbsp;&#39;&nbsp;AND&nbsp;T.SerialNumber&nbsp;&lt;=&nbsp;&#39;+cast&nbsp;(@Page&nbsp;&nbsp;as&nbsp;varchar(10))&nbsp;+&nbsp;&#39;*&#39;&nbsp;+cast(&nbsp;@CurrentPageRow&nbsp;as&nbsp;varchar(10))IF&nbsp;@Sort&nbsp;IS&nbsp;NOT&nbsp;NULL&nbsp;ANDRTRIM(LTRIM(@Sort))&nbsp;&lt;&gt;&nbsp;&#39;&#39;BEGINIF&nbsp;@Criteria&nbsp;IS&nbsp;NOT&nbsp;NULL&nbsp;AND&nbsp;&nbsp;RTRIM(LTRIM(@Criteria))&nbsp;&lt;&gt;&nbsp;&#39;&#39;BEGINSET&nbsp;&nbsp;@Str&nbsp;=&nbsp;@Str&nbsp;+&nbsp;&nbsp;&nbsp;&#39;&nbsp;AND&nbsp;(&#39;&nbsp;+&nbsp;@Criteria&nbsp;+&nbsp;&#39;)&nbsp;o&#114;DER&nbsp;BY&nbsp;&#39;+@Sort&nbsp;ENDELSEBEGINSET&nbsp;&nbsp;@Str&nbsp;=&nbsp;@Str&nbsp;+&nbsp;&nbsp;&nbsp;&#39;&nbsp;AND&nbsp;&nbsp;(&#39;&nbsp;+&nbsp;@Criteria&nbsp;+&nbsp;&#39;)&nbsp;o&#114;DER&nbsp;BY&nbsp;&#39;+@Sort&nbsp;ENDENDELSEBEGIN&nbsp;IF&nbsp;@Criteria&nbsp;IS&nbsp;NOT&nbsp;NULL&nbsp;AND&nbsp;&nbsp;&nbsp;RTRIM(LTRIM(@Criteria))&nbsp;&lt;&gt;&nbsp;&#39;&#39;BEGINSET&nbsp;@str&nbsp;=&nbsp;@str&nbsp;+&nbsp;&nbsp;&#39;&nbsp;AND&nbsp;(&#39;&nbsp;+&nbsp;@Criteria&nbsp;+&nbsp;&#39;)&nbsp;&nbsp;&#39;&nbsp;&nbsp;&nbsp;ENDEND--对无记录时当前页数的处理&nbsp;IF&nbsp;@TotalCount=0BEGINSET&nbsp;@Page&nbsp;=&nbsp;0ENDENDEXEC&nbsp;&nbsp;sp_ExecuteSql&nbsp;@Str&nbsp;<br/>&nbsp;<br/>由于本行业网站可以提高如下几类信息资源，现列表分示如下：<br/><br/>ID&nbsp;检索内容&nbsp;数据表&nbsp;检索命令示例&nbsp;<br/>1&nbsp;投资&nbsp;CapitalInfoTab&nbsp;DECLARE&nbsp;@RC&nbsp;int&nbsp;<br/>DECLARE&nbsp;@TableViewQueryName&nbsp;varchar(1024)&nbsp;<br/>DECLARE&nbsp;@SearchKeyword&nbsp;nvarchar(100)&nbsp;<br/>DECLARE&nbsp;@Sel&#101;ctStr&nbsp;varchar(500)&nbsp;<br/>DECLARE&nbsp;@Criteria&nbsp;varchar(8000)&nbsp;<br/>DECLARE&nbsp;@Sort&nbsp;varchar(255)&nbsp;<br/>DECLARE&nbsp;@FristTopNum&nbsp;int&nbsp;<br/>DECLARE&nbsp;@Page&nbsp;bigint&nbsp;<br/>DECLARE&nbsp;@CurrentPageRow&nbsp;bigint&nbsp;<br/>DECLARE&nbsp;@TotalCount&nbsp;bigint&nbsp;<br/>DECLARE&nbsp;@Totaltimes&nbsp;bigint&nbsp;<br/>　&nbsp;<br/>--&nbsp;TODO:&nbsp;在此处设置参数值。&nbsp;<br/>&nbsp;SET&nbsp;@SearchKeyword&nbsp;=&nbsp;&#39;地产项目&#39;&nbsp;<br/>&nbsp;SET&nbsp;@Sel&#101;ctStr&nbsp;=&nbsp;&#39;*&#39;&nbsp;<br/>&nbsp;SET&nbsp;@Sort&nbsp;=&nbsp;&#39;&#39;&nbsp;<br/>&nbsp;SET&nbsp;@Page=&nbsp;1&nbsp;<br/>&nbsp;SET&nbsp;@CurrentPageRow&nbsp;=&nbsp;20&nbsp;<br/>&nbsp;&nbsp;<br/>EXECUTE&nbsp;@RC&nbsp;=&nbsp;[InvestDM].[dbo].USP_CapitalInfo_FullIndex&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;@TableViewQueryName&nbsp;<br/>&nbsp;&nbsp;,@SearchKeyword&nbsp;<br/>&nbsp;&nbsp;,@Sel&#101;ctStr&nbsp;<br/>&nbsp;&nbsp;,@Criteria&nbsp;<br/>&nbsp;&nbsp;,@Sort&nbsp;<br/>&nbsp;&nbsp;,@FristTopNum&nbsp;<br/>&nbsp;&nbsp;,@Page&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;,@CurrentPageRow&nbsp;<br/>&nbsp;&nbsp;,@TotalCount&nbsp;OUTPUT&nbsp;<br/>&nbsp;&nbsp;,@Totaltimes&nbsp;OUTPUT&nbsp;<br/>Sel&#101;ct&nbsp;@Page,@TotalCount,@Totaltimes&nbsp;<br/>2&nbsp;融资&nbsp;ProjectInfoTab&nbsp;DECLARE&nbsp;@SearchKeyword&nbsp;nvarchar(100)&nbsp;&nbsp;--传入的查询关键字&nbsp;<br/>SET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@SearchKeyword&nbsp;=&nbsp;&#39;深圳&#39;&nbsp;<br/>　&nbsp;<br/>Sel&#101;ct&nbsp;&nbsp;p.title,&nbsp;&nbsp;<br/>p.infoid,&nbsp;<br/>f.[rank]&nbsp;,&nbsp;<br/>keyword,title,provinceName,cityName,CountyName&nbsp;&nbsp;<br/>&nbsp;&nbsp;<br/>FROM&nbsp;&nbsp;<br/>FREETEXTTABLE([ProjectInfoFactTab],&nbsp;(provinceName,cityName,CountyName,keyword,title),&nbsp;@SearchKeyword)&nbsp;AS&nbsp;f&nbsp;<br/>INNER&nbsp;JOIN&nbsp;[ProjectInfoFactTab]&nbsp;AS&nbsp;p&nbsp;<br/>ON&nbsp;f.[key]&nbsp;=&nbsp;p.infoID&nbsp;&nbsp;<br/>o&#114;DER&nbsp;BY&nbsp;RANK&nbsp;DESC&nbsp;<br/>3&nbsp;招商&nbsp;MerchantInfoTab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DECLARE&nbsp;@SearchKeyword&nbsp;nvarchar(100)&nbsp;&nbsp;--传入的查询关键字&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;SET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@SearchKeyword&nbsp;=&nbsp;&#39;深圳&#39;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;Sel&#101;ct&nbsp;&nbsp;&nbsp;<br/>&nbsp;ROW_NUMBER()&nbsp;OVER&nbsp;(ORDER&nbsp;BY&nbsp;RANK&nbsp;DESC)&nbsp;AS&nbsp;SerialNumber&nbsp;,&nbsp;<br/>&nbsp;F.[rank],&nbsp;&nbsp;<br/>&nbsp;p.*&nbsp;&nbsp;<br/>&nbsp;FROM&nbsp;&nbsp;<br/>&nbsp;FREETEXTTABLE(&nbsp;MerchantInfoFactTab&nbsp;,&nbsp;(ProvinceName,&nbsp;CityName,&nbsp;&nbsp;&nbsp;&nbsp;CountyName,&nbsp;Keyword,&nbsp;&nbsp;<br/>&nbsp;Title&nbsp;,IndustryBName&nbsp;,&nbsp;shortcontent,&nbsp;ZoneAbout&nbsp;,&nbsp;ZoneAboutBrief,&nbsp;MerchantTypeName&nbsp;,MerchantAttributeName,<br/><br/>CooperationDemandName&nbsp;)&nbsp;,<br/><br/>@SearchKeyword)&nbsp;AS&nbsp;f&nbsp;<br/>&nbsp;<br/>&nbsp;INNER&nbsp;JOIN&nbsp;&nbsp;&nbsp;MerchantInfoFactTab&nbsp;&nbsp;&nbsp;AS&nbsp;p&nbsp;&nbsp;&nbsp;<br/>&nbsp;ON&nbsp;f.[key]&nbsp;=&nbsp;p.infoID&nbsp;<br/>4&nbsp;资讯&nbsp;NewsTab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DECLARE&nbsp;@SearchKeyword&nbsp;nvarchar(100)&nbsp;&nbsp;--传入的查询关键字&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@SearchKeyword&nbsp;=&nbsp;&#39;深圳&#39;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sel&#101;ct&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;ROW_NUMBER()&nbsp;OVER&nbsp;(ORDER&nbsp;BY&nbsp;RANK&nbsp;DESC)&nbsp;AS&nbsp;SerialNumber&nbsp;,&nbsp;&nbsp;<br/>&nbsp;F.[rank]&nbsp;,&nbsp;<br/>&nbsp;&nbsp;p.*&nbsp;&nbsp;&nbsp;<br/>&nbsp;FROM&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;FREETEXTTABLE(&nbsp;NewsInfoFactTab&nbsp;,&nbsp;(AreaName,&nbsp;&nbsp;&nbsp;Keyword,&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;Title&nbsp;,&nbsp;DisplayTitle,&nbsp;subtitle&nbsp;,Summary&nbsp;,&nbsp;Content&nbsp;&nbsp;,NewsIndustryName&nbsp;,&nbsp;&nbsp;&nbsp;&nbsp;NewsTypeName&nbsp;)&nbsp;,&nbsp;@SearchKeyword&nbsp;)&nbsp;AS&nbsp;f&nbsp;&nbsp;<br/>&nbsp;INNER&nbsp;JOIN&nbsp;&nbsp;&nbsp;NewsInfoFactTab&nbsp;&nbsp;&nbsp;AS&nbsp;p&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;ON&nbsp;f.[key]&nbsp;=&nbsp;p.infoID&nbsp;&nbsp;&nbsp;<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=71</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(5)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 15:19:34 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=71</guid>	
		<description><![CDATA[或者键入如下命令：<br/><br/>Cr&#101;ate&nbsp;FULLTEXT&nbsp;INDEX&nbsp;ON&nbsp;TableName&nbsp;KEY&nbsp;INDEX&nbsp;PK_IndexName&nbsp;ON&nbsp;&nbsp;DB&nbsp;WITH&nbsp;CHANGE_TRACKING&nbsp;AUTOAlt&#101;r&nbsp;FULLTEXT&nbsp;INDEX&nbsp;ON&nbsp;TableName&nbsp;ADD&nbsp;ColumnName&nbsp;&nbsp;&nbsp;<br/><br/><br/>b)选择或创建新的索引目录。<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/17431210.gif" border="0" alt=""/><br/>图7&nbsp;<br/><br/>c)定义填充计划。<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/17431211.gif" border="0" alt=""/><br/>图8&nbsp;<br/><br/>至此，表的全文索引已经建立完毕，表示只要键入SQL&nbsp;指令就可以完成全文检索功能。<br/><br/>第三步，开发存储过程并把结果集分页，以供前台页面调用返回查询的结果。<br/><br/>1)&nbsp;建立找资本全文检索储存过程USP_CaptialInfo_FullIndex。<br/><br/>/*&nbsp;找资本全文索引开发过程&nbsp;&nbsp;*/Cr&#101;ate&nbsp;PROCEDURE&nbsp;USP_CaptialInfo_FullIndex(@TableViewQueryName&nbsp;Varchar(&nbsp;1024&nbsp;),&nbsp;--传入的查询字符窜@SearchKeyword&nbsp;&nbsp;nvarchar(100),&nbsp;--传入的查询关键字@Sel&#101;ctStr&nbsp;&nbsp;Varchar(&nbsp;500&nbsp;),&nbsp;&nbsp;--选择列字符串&nbsp;@Criteria&nbsp;&nbsp;Varchar(&nbsp;8000&nbsp;),&nbsp;--查询条件&nbsp;@Sort&nbsp;&nbsp;&nbsp;Varchar(&nbsp;255&nbsp;),&nbsp;&nbsp;--排序字符串&nbsp;@FristTopNum&nbsp;&nbsp;int,&nbsp;&nbsp;&nbsp;--显示的第一页置顶的数目&nbsp;@Page&nbsp;&nbsp;&nbsp;bigint&nbsp;OUTPUT&nbsp;&nbsp;,&nbsp;&nbsp;--显示的当前页号&nbsp;@CurrentPageRow&nbsp;bigint,&nbsp;&nbsp;&nbsp;--页大小(显示多少行)&nbsp;&nbsp;@TotalCount&nbsp;&nbsp;bigint&nbsp;output,&nbsp;&nbsp;--通过该查询条件，返回的查询记录的总页数&nbsp;@Totaltimes&nbsp;&nbsp;bigint&nbsp;output&nbsp;&nbsp;--所有搜索时间，以秒为单位)as&nbsp;&nbsp;DECLARE&nbsp;@starttime&nbsp;datetime,&nbsp;@endtime&nbsp;datetimeSel&#101;ct&nbsp;&nbsp;@starttime&nbsp;=&nbsp;getdate()IF&nbsp;&nbsp;ISNULL(@SearchKeyword,&#39;&#39;)&nbsp;!=&#39;&#39;&nbsp;o&#114;&nbsp;&nbsp;RTRIM(@SearchKeyword)!=&#39;&#39;BEGINSET&nbsp;@TableViewQueryName&nbsp;=&nbsp;&#39;&nbsp;Sel&#101;ct&nbsp;&nbsp;&#39;+&#39;&nbsp;ROW_NUMBER()&nbsp;OVER&nbsp;(ORDER&nbsp;BY&nbsp;RANK&nbsp;DESC)&nbsp;AS&nbsp;SerialNumber&nbsp;,&#39;+&#39;&nbsp;F.[rank],&nbsp;&#39;+&#39;&nbsp;p.*&#39;&nbsp;+&#39;&nbsp;FROM&nbsp;&#39;+&#39;&nbsp;FREETEXTTABLE(&nbsp;CapitalInfoFactTab&nbsp;,&nbsp;(ProvinceName,&nbsp;CityName,&nbsp;&nbsp;CountyName,&nbsp;Keyword,Title&nbsp;,IndustryBName&nbsp;,&nbsp;shortcontent,&nbsp;ComAbout&nbsp;,&nbsp;ComBreif)&nbsp;,&#39;+&nbsp;&#39;&#39;&#39;&#39;+@SearchKeyword+&nbsp;&#39;&#39;&#39;&#39;+&#39;)&nbsp;AS&nbsp;f&nbsp;&#39;+&#39;&nbsp;INNER&nbsp;JOIN&nbsp;&nbsp;&nbsp;CapitalInfoFactTab&nbsp;&nbsp;&nbsp;AS&nbsp;p&nbsp;&nbsp;&#39;+&#39;&nbsp;ON&nbsp;f.[key]&nbsp;=&nbsp;p.infoID&nbsp;&#39;&nbsp;EXEC&nbsp;[USP_GetFrontDataList_ByFullIndex]&nbsp;@TableViewQueryName,&nbsp;@SearchKeyword,&nbsp;@Sel&#101;ctStr,&nbsp;@Criteria,&nbsp;@Sort,&nbsp;@FristTopNum,@Page&nbsp;OUTPUT&nbsp;,&nbsp;@CurrentPageRow&nbsp;,&nbsp;@TotalCount&nbsp;OUTPUTEND&nbsp;ELSE&nbsp;BEGINEXEC&nbsp;dbo.GetFrontDataList&nbsp;&#39;dbo.ProjectInfoFactTab&#39;,&nbsp;&#39;InfoID&#39;,@Sel&#101;ctStr,@Criteria,@Sort,0,&nbsp;@Page&nbsp;output,&nbsp;@CurrentPageRow,&nbsp;@TotalCount&nbsp;outputENDSel&#101;ct&nbsp;&nbsp;@endtime&nbsp;=&nbsp;getdate()Sel&#101;ct&nbsp;&nbsp;@Totaltimes&nbsp;&nbsp;=&nbsp;DATEdiff(Ms,&nbsp;@starttime&nbsp;,@endtime)RETURN&nbsp;&nbsp;<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=70</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(4)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 15:17:26 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=70</guid>	
		<description><![CDATA[CapitalInfoTab（资本信息明细表）<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/1743125.gif" border="0" alt=""/><br/><br/>ProjectInfoTab（项目信息明细表）<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/1743126.gif" border="0" alt=""/><br/><br/>MerchantInfoTab（政府招商信息明细表）<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/1743127.gif" border="0" alt=""/><br/><br/>四、数据库全文检索实现&nbsp;<br/><br/>至此，我们已经完成了全文检索的设计工作，现在可以来实现它的功能啦！<br/><br/>首先，&nbsp;让我们建立检索表的全文检索，全文检索要求唯一索引，故需要在相关表建立唯一聚集索引。<br/><br/>第二步，使用SQL&nbsp;DDL或者SQL&nbsp;Server&nbsp;Management&nbsp;Studio建立表的全文检索。<br/><br/>1）使数据库支持全文检索。<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/1743128.gif" border="0" alt=""/><br/>图5&nbsp;<br/><br/>或者通过键入命令&nbsp;&nbsp;EXEC&nbsp;SP_FULLTEXT_DATABASE&nbsp;&nbsp;&#39;Enable&#39;&nbsp;&nbsp;命令达到同样效果。<br/><br/>2）定义表的全文检索目录和索引字段。<br/><br/>在表的鼠标右键通过点击“全文检索\定义全文检索”将弹出如下执行向导，本向导执行完毕则该表的全文检索业已完毕。<br/><br/>a)选择要索引的字段<br/><img src="http://new.51cto.com/files/uploadimg/20080111/1743129.gif" border="0" alt=""/>&nbsp;<br/>图6&nbsp;]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=69</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(3)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 14:56:18 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=69</guid>	
		<description><![CDATA[三、网站全文检索设计<br/><br/>1、架构设计&nbsp;<br/><br/>采用OLTP交易数据库和OLAP数据仓库（用于搜索和分析）分离的模式，OLTP作为OLAP的数据源通过SQL&nbsp;Server&nbsp;Integration&nbsp;Services&nbsp;(SSIS)定期导入到OLAP数据仓库环境中，OLAP采用星型结构以便于更好地满足搜索和将来的数据挖掘。&nbsp;OLAP数据仓库的建立目标为了检索和数据挖掘，故其事实表的建立可以反范式原则设计。<br/><br/>&nbsp;<br/>图2&nbsp;<br/><br/>2、原型设计（由于篇幅限制，这里仅给出搜索主页和主要资源查询页面）<br/><br/>&nbsp;<br/>图3&nbsp;<br/><br/>3、数据库设计<br/><br/>&nbsp;<br/>图4&nbsp;<br/><br/>4、数据字典<br/><br/>MainInfoTab(信息主表)]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=68</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(2)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 14:54:55 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=68</guid>	
		<description><![CDATA[SQL&nbsp;Server中的全文搜索的体系结构如下所示。<br/><br/>&nbsp;<br/><img src="http://new.51cto.com/files/uploadimg/20080111/1743120.gif" border="0" alt=""/><br/>图1&nbsp;<br/><br/>让我们逐一介绍两类重要的引擎及其在整个体系结构中的重要作用。<br/><br/>Full-Text&nbsp;Engine&nbsp;for&nbsp;SQL&nbsp;Server&nbsp;(MSFTESQL)<br/><br/>MSFTESQL&nbsp;服务负责进行下列操作：<br/><br/>◆填充全文索引。<br/>◆管理全文索引和全文目录。<br/>◆帮助对&nbsp;SQL&nbsp;Server&nbsp;数据库中的表进行全文搜索。<br/><br/>让我们来看看SQL&nbsp;Server&nbsp;2005全文索引的过程<br/><br/>全文填充（也称为爬网或爬虫）开始后，数据库引擎会将大批数据存入内存并通知&nbsp;Microsoft&nbsp;SQL&nbsp;Server&nbsp;全文引擎&nbsp;(MSFTESQL)&nbsp;服务开始进行索引。MSFTESQL&nbsp;服务将对表的某一列或几列中的字符和格式化二进制数据编制索引。全文引擎将使用协议处理程序组件从内存中取出数据并进行进一步处理，从而生成全文索引。<br/><br/>对存储在&nbsp;varbinary(max)&nbsp;或&nbsp;image&nbsp;列中的数据编制索引时，筛选器（实现了&nbsp;IFilter&nbsp;接口）将基于为该数据指定的文件格式（例如，Microsoft&nbsp;Word）来提取文本。在某些情况下，筛选器组件会要求将&nbsp;varbinary(max)&nbsp;或&nbsp;image&nbsp;数据写到服务帐户&nbsp;Temp&nbsp;目录中，而不是将其存入内存。<br/><br/>在处理过程中，通过断字符将收集到的文本数据分隔成各个单独的标记或关键字。用于标记化的语言将在列级指定，或者也可以通过筛选器组件在&nbsp;varbinary(max)、image&nbsp;或&nbsp;xml&nbsp;数据内标识。<br/><br/>还可能执行其他处理以删除干扰词并在将标记存储到全文索引或索引片断中之前将这些标记规范化。&nbsp;<br/><br/>Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;for&nbsp;SQL&nbsp;Server&nbsp;的功能<br/><br/>SQL&nbsp;Server&nbsp;2005&nbsp;为全文引擎提供了并行安装方式。这意味着对于每个&nbsp;SQL&nbsp;Server&nbsp;实例，都存在一个专用的&nbsp;MSFTESQL&nbsp;实例，其中包括专用的组件（例如断字符和筛选器）、资源（例如内存）和配置（例如服务级设置，实例级的&nbsp;resource_usage&nbsp;是一个更具体的例子）。单个&nbsp;MSFTESQL&nbsp;服务实例可管理相关联的&nbsp;SQL&nbsp;Server&nbsp;实例的全文索引。利用&nbsp;MSFESQL&nbsp;服务，SQL&nbsp;Server&nbsp;可超出&nbsp;SQL&nbsp;标准对字符串列执行更为复杂的搜索。<br/><br/>MSFTESQL&nbsp;服务担当了以下角色：&nbsp;<br/><br/>索引支持&nbsp;<br/><br/>MSFTESQL&nbsp;实现了为数据库定义的全文目录和索引。<br/><br/>查询支持&nbsp;<br/><br/>MSFTESQL&nbsp;可处理全文搜索查询并确定索引中符合全文选择条件的项。对于符合选择条件的每一项，MSFTESQL&nbsp;将向&nbsp;SQL&nbsp;Server&nbsp;服务返回相应行的标识外加一个排名值，而后者将使用这些信息来构造查询结果集。所支持的查询类型包括：<br/><br/>◆搜索词或短语。<br/>◆搜索位置邻近的词。<br/>◆搜索词的变形。&nbsp;<br/><br/>可管理性支持&nbsp;<br/><br/>全文目录和索引不会存储在&nbsp;SQL&nbsp;Server&nbsp;数据库中。MSFTESQL&nbsp;服务负责管理全文目录。<br/><br/>Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;Filter&nbsp;Daemon<br/><br/>MSFTEFD&nbsp;由负责从表中访问和筛选数据以及进行断字和词干分析的组件组成。<br/><br/>◆筛选器<br/><br/>筛选器的任务是从文档中提取文本化信息流，并舍弃所有非文本化信息和格式化信息。筛选器将生成文本字符串和属性/值对，并依次将它们传递给索引引擎。&nbsp;<br/><br/>筛选器可从特定的文档格式（如&nbsp;Microsoft&nbsp;Word&nbsp;文档或文本文件）中提取文本化信息。例如，Microsoft&nbsp;提供了&nbsp;Microsoft&nbsp;Office&nbsp;筛选器，此筛选器可以从&nbsp;Word、Microsoft&nbsp;Excel&nbsp;和&nbsp;Microsoft&nbsp;PowerPoint&nbsp;文件中提取文本和属性。其他筛选器用于处理&nbsp;HTML&nbsp;或电子邮件。还可以使用第三方筛选器。&nbsp;<br/><br/>◆SQL&nbsp;协议处理程序<br/><br/>在&nbsp;SQL&nbsp;Server&nbsp;2005&nbsp;中，SQL&nbsp;协议处理程序的工作是从指定数据库中的表内访问数据。<br/><br/>断字符<br/><br/>断字符是用于在查询或抓取的文档中确定字符流中的字符边界位置。有关详细信息。<br/><br/>全文搜索的索引组件负责全文索引的初始填充，以及当全文索引表中的数据被修改时该索引的后续更新。为了提升全文索引过程的效率，Microsoft&nbsp;SQL&nbsp;Server&nbsp;2005&nbsp;改进了全文收集机制的体系结构，从而大大增强了性能。<br/><br/>Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;for&nbsp;SQL&nbsp;Server&nbsp;(MSFTESQL)&nbsp;服务是一个全文索引和搜索引擎。MSFTESQL&nbsp;引擎基于&nbsp;Microsoft&nbsp;Search&nbsp;(MSSearch)&nbsp;技术，它与&nbsp;Microsoft&nbsp;SQL&nbsp;Server&nbsp;2005&nbsp;Database&nbsp;Engine&nbsp;进行了最为紧密的集成。&nbsp;<br/><br/>全文引擎作为&nbsp;MSFTESQL&nbsp;服务在操作系统上运行。SQL&nbsp;Server&nbsp;与&nbsp;MSFTESQL&nbsp;必须拥有相同的服务帐户。默认情况下将安装&nbsp;MSFTESQL&nbsp;服务，但是只有在使用全文搜索时才会运行此项服务。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=67</link>
			<title><![CDATA[SQL Server 2005全文检索技术在网站上的应用实录(1)]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Oct 2008 14:53:57 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=67</guid>	
		<description><![CDATA[一、前言<br/><br/>“人类失去搜索，世界将会怎样?”，同样，很难想象一个拥有极大信息量的行业网站门户没有站内全文搜索将会出现怎样的局面，网站全文检索对于挖掘网站信息和整合网站资源的价值是不言而喻的。我们看到，通用型的搜索引擎已经成为了互联网世界的门户，而对于一个信息量极其丰富的网站而言，全网搜索或许会成为本网站的门户，正是所谓的门户之门。<br/><br/>实现网站全文检索有几种常见方案，比如应用数据库全文检索，开源搜索引擎，使用Google&nbsp;API等，&nbsp;本文我们将就如何使用SQL&nbsp;Server&nbsp;2005多快好省地建立网站全文检索展开探讨。<br/><br/>二、全文检索技术说明<br/><br/>1、应用背景&nbsp;<br/><br/>先介绍下Z网站，它是国内投融资行业最大的行业门户，网站拥有海量的融资信息、投资信息、招商信息、创业信息、商机信息、资讯信息、产权交易信息、招标投标信息、中标信息、会展信息等投融资行业的信息资源。网站全文检索实现的首要需求就在于能够让用户输入诸如行业关键字后系统能快速返回给符合用户在全范围内查找条件的记录,&nbsp;从而有效地利用资源，更好地满足用户需求。<br/><br/>2、主要检索技术的区别&nbsp;<br/><br/>有了数据但是没有被使用，那么这些数据不应该被称为信息。它们无非是不断充斥设备和网络的比特而已，但是如何把数据挖掘出来提供给需要的人员，检索技术是其中非常有效的途径之一。<br/><br/>现基于微软平台，针对SQL&nbsp;Server&nbsp;2005提供的全文检索技术进行介绍。与关系数据查询、多维数据库查询和基于XML的XQuery、XPath不同，全文检索技术主要处理对象是基于超大&nbsp;数据量的文本数据和结构化的二进制数据上类似LIKE的模糊查询。主要区别见下表。&nbsp;&nbsp;<br/><br/>表1：全文检索与关系数据库查询、多维数据查询、XML查询的对比<br/><br/>　&nbsp;关系数据库查询&nbsp;多维数据查询&nbsp;XML查询&nbsp;全文检索&nbsp;<br/>检索技术&nbsp;SQL&nbsp;MDX&nbsp;XQuery、XPath&nbsp;SQL&nbsp;(extension)&nbsp;<br/>主要处理对象&nbsp;关系二维数据&nbsp;结构化多维数据&nbsp;层次型数据&nbsp;大容量二维和层次型数据的模糊检索&nbsp;<br/>主要应用领域&nbsp;一般的OLTP类应用&nbsp;一般的OLAP类分析型应用&nbsp;面向Internet、Intranet的松散耦合SOA应用&nbsp;企业/网站内部信息/知识管理类应用&nbsp;<br/>索引&nbsp;大量使用非聚簇索引，一般保存在数据库中。&nbsp;通过层次型、保存中间结果的方式，通过不同的轴向快速定位信息剖面。&nbsp;基于XPath的索引，索引一般保存在数据库中。&nbsp;基于关键字的索引，保存在文件系统中。每个表仅支持一个索引。&nbsp;<br/><br/><br/>3、全文检索技术简要介绍&nbsp;<br/><br/>全文检索主要应用领域如下：&nbsp;<br/><br/>（1）大数据量、超大数据量的结构化平文本数据和模糊匹配查找（Char、Varchar、Nvarchar）。&nbsp;<br/><br/>（2）大数据量、超大数据量的层次型XML数据展开后的查找---含模糊查找（Xml&nbsp;type）。&nbsp;<br/><br/>（3）标准格式的二进制非结构化Word数据的查找（VarBinary[max]、Image）。&nbsp;<br/><br/>与其他检索技术不同的是，全文检索不仅仅提供词汇层次的查询支持，而且可以根据语言环境、不同语言的特点，甚至于用户自定义的配置提供不同语义级的大容量的数据模糊匹配检索支持。为了提供语义层次的检索，SQL&nbsp;Server&nbsp;2005的全文检索明确了如下几个概念：&nbsp;<br/><br/>（1）断字符（Word&nbsp;Breaker）：因为对于不同的语言，哪些符号可以用于词汇的分割是不同的，因此全文检索支持不同语言环境的不同断字符。&nbsp;<br/><br/>（2）标记（Token）：是由断字符标识的词或字符串。由于划分是基于特定语言完成的，因此也可以做到语义层次的支持。&nbsp;<br/><br/>（3）干扰词（Noise&nbsp;Word）：主要是那些经常出现，但是对于检索没有多少帮助的词汇。例如：英语中的“a”、&nbsp;“and”、&nbsp;“is”、&nbsp;“the”，汉语中的“的”、&nbsp;“不”、&nbsp;“以”、&nbsp;“了”等。SQL&nbsp;Server&nbsp;2005中提供配置文件，允许用户自定义自己语言、甚至与本行业、本企业的检索干扰词。&nbsp;<br/><br/>（4）词干分析器（Stemmer）：通过断字符分割后，根据具体的语言和该语言的语法规程生成的特定词汇的变形。&nbsp;这个即是搜索引擎常提到的分词技术。<br/><br/>（5）同义词：即便是同一个语言，在检索的情况下也存在同义词如何处理的问题。如果一个检索系统不能够识别近义词，而只能识别完全匹配的词汇，那对于我们中文这种表义的语言而言会带来很大不便。同样的，一个行业内部也有很多同义词或者是缩略语。例如如下的词语。&nbsp;<br/><br/>广播行业：“ABC”与“英国ABC广播公司”基本上类似，但是也可能和“澳大利亚广播公司”混淆。&nbsp;<br/><br/>政府行文：“ABC”与南美的“阿根廷、巴西、智利三国”是同义词。&nbsp;<br/><br/>不仅如此，由于日常使用的习惯，我们在口语表达和书面语表达上也有区别，这个也需要预先定义。例如，很多口头常用的技术产品“Win2K”、&nbsp;“WinXP”等，一般都很正式的称为“Windows&nbsp;2000”和&nbsp;“Windows&nbsp;XP”，因此SQL&nbsp;Server&nbsp;2005上也提供类似词汇替换的支持，而且这些支持也是与具体语言相关的。<br/><br/>4、SQL&nbsp;Server&nbsp;2005全文检索的技术架构&nbsp;<br/><br/>让我们首先得问自己，什么是全文检索？它是指Microsoft&nbsp;SQL&nbsp;Server&nbsp;2005&nbsp;具备针对&nbsp;Microsoft&nbsp;SQL&nbsp;Server&nbsp;表中基于纯字符的数据进行全文查询的功能。全文查询可以包括词和短语，或者词或短语的多种形式。<br/><br/>当我们明确了全文检索概念之后，我们来看看它的内部结构。<br/><br/>Microsoft&nbsp;SQL&nbsp;Server&nbsp;2005&nbsp;中的全文搜索由&nbsp;Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;for&nbsp;SQL&nbsp;Server&nbsp;(MSFTESQL)&nbsp;服务提供支持。MSFTESQL&nbsp;服务有两个角色，即索引支持和查询支持。&nbsp;<br/><br/>全文搜索的组件<br/><br/>全文搜索的体系结构由下列组件构成：<br/><br/>◆Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;for&nbsp;SQL&nbsp;Server&nbsp;(MSFTESQL)<br/>◆Microsoft&nbsp;Full-Text&nbsp;Engine&nbsp;Filter&nbsp;Daemon&nbsp;(MSFTEFD)，它包含下列组件：<br/>（1）筛选器<br/>（2）协议处理程序<br/>（3）断字符]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=66</link>
			<title><![CDATA[Oracle9i的全文检索技术]]></title>
			<author>jaddy0302@126.com(admin)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Wed,15 Oct 2008 14: