<?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[致力于以数据和搜索为核心的业务 （全文检索、舆情监控、搜索引擎产品）]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog2 v2.4]]></copyright>
<webMaster><![CDATA[webmaster@xd-tech.com(线点科技)]]></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=144</link>
			<title><![CDATA[广告的目的不是促销（4）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Fri,25 Mar 2011 15:15:29 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=144</guid>	
		<description><![CDATA[二、广告的沟通手段&nbsp;<br/>1、&nbsp;广告不是说服、不是打动&nbsp;<br/>无论是广告人或广告主，都一心想着通过对消费者的说服将产品推销出去，然而，却是这些意欲强加给消费者的观念和做法，加上广告无休止的重复，引发了人们普遍的反感。广告在没有开始说服之前，就把消费者看成了被说服的对象，在这种对立的状态下，你愈是强硬推销，愈是适得其反。这样的广告无论你说什么都象在告诉消费说，你好好坐在那里一分钟，看我怎么说服你来买这个产品，其效果可想而知。为此，黄文博先生说：“当一位高明的传教士向群众布道时，他不会试图说服大家对神产生信仰，那将使他与听众处于一种对立状态，愈强势的说服，会激起愈强力的抗拒。即陷入单向传播的死胡同。”&nbsp;<br/>黄先生认为关键在于打动，而非说服。其实，打动和说服并没有本质上的区别，“说服”采取的是由上而下的高压姿态；“打动”则是一种由下而上的劝服。这两种极端的态度，都不约而同地站在消费者的对立面，把消费者视为停止不变的固执的个体。同样容易陷入“单向传播的死胡同”。&nbsp;<br/>一般情况下，我们对一个广告进行分析时，都会不自觉地从广告或广告人的角度作判断，能看到的、或希望看到的大都是广告内含的高明的说服或打动技巧。而往往容易忽视被“说服”和“打动”的一方——受众。消费者真的被说服或打动了吗？其实未必。一件事物，比如面对一栋楼房，假如你只是站在楼的一面进行观察，就只能通过经验和推理判断说这是一栋楼房，尽管映入你眼帘的只是一堵平面的墙。但如果你到楼房的四周看看，从不同的角度加以观察。情况就不同了，你将会看到一栋立体的、真实的楼房。也或许会发现这其实只是一堵用来拍戏用的平面的楼房布景。我们不得不这么做，因为受众正在楼房的另一边呢。&nbsp;<br/>2、&nbsp;广告不是获得认同&nbsp;<br/>认同和“说服”以及“打动”不同的地方在于，广告把自己放到了一个与受众水平相当的位置上，对立的成分减少了，但自我意识也被强化了，孤立的状态也更加明显，尽管它看上去亲和了许多。&nbsp;<br/>“认同”意味着什么呢？意思是你向对方表明了你对某一事物的观念和看法。比如速溶咖啡刚推出市场时，广告说它是省时省事的，你说家庭主妇们认同这种观念吗，事实上这种观念无可反驳，速溶咖啡和传统咖啡相比的确省时省事。但这并不意味着她就必须和广告持一样的观念，以同样的态度和行动去回应这种观念。&nbsp;<br/>观念是最多样化和难以捉摸的东西，它容易获得认同，却很难引发一致的行为。我们大部分人都能够认同别人对婚姻和爱情的看法和观念，却也坚持自己的观念，甚至固执得很。&nbsp;<br/>3、&nbsp;不是共鸣而是反应&nbsp;<br/>共鸣通常是针对情感内容而言的，它更接近于传播的心理学基础。但在观念上还未能摆脱“说服”的影响。“情感广告的说服作用具体体现在，积极性的情感反应会导致对广告中特定商标（商品）的积极态度。也就是说，一则令人兴奋或充满亲切感的广告会使受众对该广告的特定商标（产品）产生好感。”（引自《广告心理》）&nbsp;<br/>共鸣，即广告所描述的情感性质和受众的个体情感体验之间具有共同的特征。广告的情节和体现的情感具有一定的完整性，而受众在这一方面的情感体验也是相对完整的，这是产生共鸣的基础。从结构上看，这两个方面是并置的，其情感体验的结果并没有发生质和量的改变，是一加一等于一的模式。因此，我们才说它是共鸣性质的。我们一心一意追求广告效力最大化，但“共鸣”是具有局限性的，“共鸣”在人类的情感体验中是温和的、缺乏爆炸力的。&nbsp;<br/>在广告心理学方面的研究，通常把广告作品本身等同于生活当中的一般事物、一般情感，&nbsp;<br/>在引发情感反应的作用力上是一样的。其实不然，广告作品通常是某种情感浓缩的典型，而生活中的一般事物、一般情感却是有待激发的零散元件。&nbsp;<br/>“在广告画面中，突出一位受人爱戴的金牌获得者在观众的一片欢呼声中接受奖杯的情景。这能够使观看者受到感染，产生共鸣。”（引自《广告心理》）在这样一个广告中，情节所体现的情感是完整的、具典型性的，它和受众的民族自豪感、荣誉感是并置的，其情感体验模式是共鸣性的，信息的传递具有一定的新闻告知性质。因而不具有深刻的体验性和震撼性。这和一个观众收看完整的比赛过程，随着运动员过关斩将、历尽曲折，最后登上领奖台，听着国歌奏响，看到运动员眼中幸福的泪光。其情感体验的强度是完全不同的。这样的情感体验是试剂式的，是反应性的。它是由这些连续的、不经刻意编排的非典型性情节所引发的，而观众在观看比赛时并不把这种情感体验当成观看的目的，他更多是冲着人类的竞技水平和精神而来的，结果却引发了他的民族自豪感和集体荣誉感，致使他也激动得满眼泪光。就象一种化学物质滴入另一种物质引起的反应一样，其产生的情感体验强度更激烈、持久和深刻。这就是情感共鸣和情感反应的差异。共鸣是情感反应的一种形式，但情感反应并不等同于情感共鸣，它们之间存在着质和量上的根本区别。&nbsp;<br/>在日常生活中，我们对某一事物的认识，可以通过老师的教导或书本等途径而得到。他们相当直截了当地告诉你某一事物的真实面貌，你只需要去接受就可以了。但如果你是运用自己的智慧和潜心研究而发现某一事物的真相，所获得的情感体验程度要比被动接受要更加震撼，甚至可能因为激动而出现手舞足蹈、声音发颤、血压飙升等生理反应。“反应”的优势是明显的，“共鸣”把受众视为相对被动，“反应”则强调受众的参与度、主动性和积极性；“共鸣”引发的的情感体验是相对静止的，“反应”则是充满运动的、爆炸性的。“共鸣”只是共鸣，反应则可能产生惊人的、意想不到的效果。&nbsp;<br/>至此，我们要给出的报告是——广告所应作出的所有努力是——引发受众的情感反应。&nbsp;<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=143</link>
			<title><![CDATA[广告的目的不是促销（3）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,08 Mar 2011 14:02:23 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=143</guid>	
		<description><![CDATA[广告目的的性质&nbsp;<br/>　　一个政治家和一个将军的目的和行事方式是完全不同的，广告主和广告代理商也应该明确这种区别。一个政治家考虑的是政治权力或国家版图的扩张，或者是某种明显的战略优势的建立。而一个将军则考虑如何&nbsp;“使对手处于一种比接受我方的要求所做的牺牲还更不利的处境中”，那就是完全解除对手的武装。因此，广告主实在不适宜过度干涉广告代理商的广告决策，我们可以试想一个政治家为一个将军排兵布阵大都会陷入怎样的可怕局面。在广告中最经常出现的就是毫无技巧的广告暴力，所谓的暴力就是在一定程度上排斥智力的合作，那意味着你要有加倍的或多倍的广告投入，采取强硬的手段才能获得一定的地盘，这种手段会使竞争对手有所顾忌，能获得一定的市场效应和加强投资者的信心，也能吸引一些相对盲目的认为广告做得多产品就信得过的消费者。但最终其所付出的代价却与真正的市场价值不相符合，甚至是严重的得不偿失，一旦造成这种局面，整个广告运动甚至产品都必须放弃，因为广告或者传播名声并不是独立的行为，它完全受销售目的的支配，销售的价值决定了所应作投入的程度，继续消耗广告资源意味着更彻底的失败。只有一种情况是例外的，就是当你的产品处于垄断的地位，又是相对的生活必须品。这种案例比比皆是。当然，代理商也不应过分高估和夸大自身的能力，把自己变成一个没有作战能力的不切实际的广告政治家，应该明白作为一个广告将军的目的和意义。&nbsp;<br/>　&nbsp;广告目的是销售目标的前提之一，在与受众的精神意志较量中获胜是达成交易和形成忠诚的基础条件，也是真正务实和彻底的广告观念。销售目的本身应该适应广告这种营销手段的独特性质，虽然销售目的通常作为广告运动的首要考虑因素，并交织在全部广告运动之中，但切不可越蛆代庖、本末倒置。尽管如此，广告仍然象战争一样复杂多变、难以掌握。来自于各方的干扰和不确定因素太多，包括竞争对手的广告攻势、不断变化的市场环境等，尤其是消费者喜新厌旧的坏习惯以及难以琢磨的心理环境。幸运色彩始终是广告最明显的特征。我们并不乞求一种绝对的胜利，事实上绝对的胜利也不存在。但实在有必要对广告目的作出目标性的概括。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=142</link>
			<title><![CDATA[广告的目的不是促销（2）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,28 Feb 2011 13:10:57 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=142</guid>	
		<description><![CDATA[广告与战争&nbsp;<br/>　　广告和战争是非常相似的，中国古代的一些战争理论，如《孙子兵法》等和毛泽东的战略思想在市场营销中都得到良好的诠释和应用。东方的战争理论较偏重于战略或战术性的研究，一般都只关心怎样去赢得战争，对于战争的目的和本质分析都没有《战争论》来得全面和彻底。了解克劳塞维茨和其《战争论》的人会认同我们的这种说法。广告也是如此，大部分的人并不想去了解广告的本质，尤其迷恋于精巧的战术运用，不能对广告的本末给予足够的重视和关注。&nbsp;<br/>　　克劳塞维茨认为战争只是达到政治目的的手段，正如广告是市场营销、产品销售的手段一样。但从纯粹战争的角度来看，“我们必须说战争的政治目的与战争本身毫无关系，因为战争是一种强迫敌人实现我方意志的暴力行为，它都是有赖于我们能够打倒敌人，也就是解除其武装，而且仅只依赖这一点”。迫使敌人向我方意志屈服是一种最后的政治目的，为了充分达到这一目的，必须解除敌人的武装，所以在理论上，解除武装也就变成战争的直接目的。它取最后目的的地位而代之，并且把政治目的摆在一边。如果还要继续对战争的手段和目的进行划分，暴力则是战争的手段；暴力本身也并非目标，否则“手段就会和目的完全丧失关系”。&nbsp;<br/>　　诚如战争，企业的销售目标对于决定广告运动的目标以及所应做的努力都将是一种标准。但销售目标本身并不能对广告提供衡量的标准，它是广告与消费者有效沟通产生的作用和结果。假使广告目的是销售目的的一种相当物，那么当销售目标缩小时，广告规模和力量也会随之减小，而当销售目标愈大时，广告力度也就必须愈大，一旦减少广告力量，销售也就会随之下滑。甚至成倍地加大了广告投入，销售情况也未会见起色。这是所有企业都不愿见到的情况，但事实是这种现象一刻也没有停止，甚至相当普遍。所以，尽管我们并不怀疑广告促进销售的作用（就象我们知道战争总是服务于某种政治目的一样），但促进销售并不是广告的直接目的，要充分达到促进销售的目的，广告所应作出的努力完全在于——“解除敌人的武装”，就算是那些降价的促销广告和怀着美好愿望的公益广告也是如此，政府的政策性宣传亦然。&nbsp;<br/>广告的性质<br/>广告是什么？我们知道广告（Advertising）最初的含义是“通知别人某件事，引起他人的注意”，后来由于广告媒介的丰富、形式的多样化、战略和战术的不同趋向，以及认识角度的差异，形成了各种不同的理论流派。无论人们持什么样的观点，都必须归结到一个最核心的点上——与受众进行有效的沟通。克劳塞维茨对战争所作的定义非常适用于广告，他说：“战争非他，不过就是一个大规模的决斗而已。假使我们把构成战争的无数决斗当作一个单位来看，则我们最好是假定其为两个角力者。每个人都想用体力迫使对方屈服于其意志之下，每个人都想摔倒其对手，并使其不能再作抵抗。”如果说战争就是利用暴力来迫使对手解除武装，那么广告就是运用一种有别于战争暴力的精神意志来与受众的思想武装进行较量，直至使其屈服于我方的意志之下——“广告非他，不过就是两种精神意志的较量罢了”<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=141</link>
			<title><![CDATA[广告的目的不是促销（1）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,15 Feb 2011 15:04:45 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=141</guid>	
		<description><![CDATA[广告的目的不是促销<br/>“广告的目的并不是促销”，写下这句话着实有些惶恐，因为这和我们接受的传统训示相违背；和广告主的崇高意愿相违背；更是对广告价值和立身根本的怀疑。说出这样的话可能会引来正义人士的围殴，或者遭受令人胆战心惊的白眼和嗤之以鼻的责难。人们会把它看成是广告人蹩脚的噱头，是对权威的无聊调戏。如果有人要因此而愤怒，那就由他去吧，生活在坚固的传统壁垒中总是安全的。&nbsp;<br/>　　美学大师朱光潜先生说：“一切事物都有几种看法，你说一件事物是美或是丑的，这是一种看法。换一种看法，你说它是真的或是假的；再换一种看法，你说它是善的或是恶的。同是一件事物，看法有多种，所看出来的现象就有多种。”同样一件事物，在不同的人看来，其结果更是相差甚远。广告的目的也是如此，有人从营销的角度去看它，其促销的动机就是勿庸质疑的现实；但从传播的角度来看，促销并非广告的直接目标，否则，手段和目的就会完全丧失应有的关系。把营销目的当成广告手段，那会使你的用意赤裸裸地展现在受众面前，其结果必然是引起消费者对广告的抗拒心理。另外，我们知道，现代的营销观念是“以消费者为中心”的，所有的营销活动都必须以消费者的需求为核心，产品的设计是如此，销售渠道的选择是如此。那么是否也应该用“以消费者为中心”的观念来看待广告，用消费者的角度和“看法”来认识广告的目的呢。“广告的目的是销售”符合消费者的需求吗？消费者看一则广告是为了让你把一个商品推销给他吗？显然不是如此。广告应该为消费者服务，为消费行为提供合理的指引。广告不是一个为“促销”而存在的事件，广告是一个为消费行为而存在的事件。总而言之，从任何单一的角度去看待广告的目的，都不能完整地说明问题，反而容易产生歧义和导致无谓的争论。我们至少应该从三个方面去认识它，其一是营销的角度，其二是传播的角度，其三是消费者的角度。这几个层次的区分并非只是在玩弄字眼，这种区分对于“整合营销传播”具有建设性的意义，整合营销传播如果仅仅只是工具的整合显然是不够的。不同角度的观念整合才是工具应用的基础。&nbsp;<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=140</link>
			<title><![CDATA[专利检索的8大作用 ]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,26 Jan 2011 13:36:03 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=140</guid>	
		<description><![CDATA[&nbsp;&nbsp;&nbsp;专利作为技术创新的重要标志和体现，在很大程度上代表着一个国家或企业的技术水平和潜在的技术竞争力。围绕专利进行的竞争将成为全球化背景下企业竞争的一个制高点。<br/>　　参与专利竞争必须充分地利用好专利文献，在企业参与竞争和企业发展中有着重要的作用。<br/>&nbsp;&nbsp;&nbsp;&nbsp;1、是有助于研究者获取最新的专利技术信息，调整研究方向，避免重复研究；&nbsp;<br/>2、是有利于启发研究者的创新思路，缩短研究开发时间；&nbsp;<br/>3、是有利于掌握竞争对手的技术发展状况，及时采取相应对策，避免侵犯他人专利权。&nbsp;<br/>详细来说可以分为以下几点&nbsp;<br/>1、把握相关领域的技术状况<br/>　　专利文献是技术资料的宝库。据世界知识产权组织的统计，全世界发明成果的90%以上会出现在专利文献中。通过对相关产业和技术领域的专利技术进行检索和分析，能够把握相关产业和技术领域的整体状况（包括重点技术现状）和发展趋势，明确行业技术创新热点及专利保护特征。<br/>　　2、了解相关企业的技术活动<br/>&nbsp;&nbsp;&nbsp;&nbsp;专利制度是被广泛认可的保护自主创新的有效方式。大多数企业通常会将自己开发出的技术尽早申请专利以求得以保护，企业的技术路线，技术布局必然会体现在其专利信息中。通过对企业的专利检索出的信息进行分析，便可以了解其技术活动及其战略布局。<br/>　　3、了解竞争对手动向<br/>　　互为竞争对手的企业必然处在相同或相近的技术领域，通过对该技术领域的专利检索信息进行分析，不仅可以发现现实的竞争对手，挖掘潜在的竞争对手，还可以通过对竞争对手在不同国家的专利文献进行分析，了解其在不同国家、不同地域的市场经营活动，竞争企业间的技术合作、技术许可动向等。<br/>　　4、了解人才分布<br/>　　通过对专利文献中的发明人信息进行分析，可容易的找到该领域的技术专家，并可以了解到这些技术专家在技术上的侧重点。<br/>　　5、预测新产品新技术的市场情况<br/>　　专利文献记载着目前最先进的科学技术。据世界知识产权组织统计，同一发明成果出现在专利文献中的时间要比出现在其它媒体上的时间平均早1～2年。通过对专利文献信息进行分析，可以预测新产品、新技术的推出，以及相关国家的市场分布和规模等。<br/>　　6、为企业的研发、投资、兼并决策等提供依据<br/>&nbsp;&nbsp;&nbsp;&nbsp;通过对相关领域的专利文献信息进行分析，可以了解相关领域的技术发展现状和发展趋势，可以为企业决策者把握特定技术的开发、投资方向、兼并收购等决策提供依据。<br/>　　7、为建立企业专利数据库指明方向<br/>&nbsp;&nbsp;&nbsp;&nbsp;通过对相关领域的专利信息进行分析，并结合企业自身的发展现状和发展目标，确定合适的技术领域，确定合适的目标跟踪对象，为建立符合企业特色，又符合行业发展趋势的专利数据库指明方向。<br/>　　8、为制定企业专利战略提供依据<br/>　　专利信息不仅包含着大量的技术信息，还含有大量法律和经济的信息，仔细分析和科学利用这些信息，可以为企业制定专利战略、企业发展战略乃至市场战略等竞争战略提供依据。&nbsp;<br/>通过跟踪调查技术发展动向，并根据出现的新情况不断调整其专利战略实施方案，使专利战略的实施更为有效，以实现专利战略的目标。专利文献是体现专利制度根本目的的媒介，它传播专利信息，促进科技进步，为经济、贸易活动提供参考信息，是对专利实施法律保护的依据和专利机构审批专利的基础。可以说专利文献是人类的知识宝库，是最新颖、最系统、最完整、最规范的技术信息源。有人将专利文献比喻为世界科学技术的备忘录、技术的大百科全书。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=139</link>
			<title><![CDATA[正确认识站内搜索]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Mon,17 Jan 2011 14:21:14 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=139</guid>	
		<description><![CDATA[正确认识站内搜索<br/>什么是站内搜索<br/>在以往网站建设、企业信息系统搭建过程中，由于信息结构简单、内容稀缺，站内搜索乃至搜索都不是网站系统的必要装备。但随着Web2.0带来的海量信息井喷式涌现，企业自身对信息架构、管理、发布的需求，以及用户对信息的组织、查询、可寻性的要求越来越高，于是站内搜索出现了。<br/>站内搜索通俗来讲是一个网站或商城的“大门口”，一般在形式上包括两个要件：搜索入口和搜索结果页面，但在其后台架构上是比较复杂的，其核心要件包括：中文分词技术、页面抓取技术、建立索引、对搜索结果排序以及对搜索关键词的统计、分析、关联、推荐等<br/>与其他通用搜索的区别<br/>像谷歌、百度、搜搜等通用搜索引擎都会免费开放站内搜索功能，以嵌入网页代码的形式保持与搜索引擎机器人的沟通、爬取，其弊病有二：<br/>1.这些通用搜索引擎不能及时、全部抓取网站最新页面内容。这对电子商务网站信息（如价格、活动有效时间等）经常更新的特点来说是致命的，用户查到的可能是过时信息。<br/>2.既然是所谓通用引擎，其对搜索结果的展示也是通用的，没有差异性的。其不能按照商城自身业务逻辑去做排序、过滤、展示是其最大的弱项<br/>因此，站内搜索的出现也是有其具体原因和需求的，在搜索的精确度和效果上击败了通用搜索引擎。<br/>站内搜索价值体现在如下：<br/>用户很“懒”，节约用户查找商品时间，提高购买转化率<br/>站内搜索已经成为电子商务网站主导航的标配<br/>对后续用户输入的关键词进行分析、提取、排名等对商城运营者来说是了解用户上网行为的最佳途径。<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=138</link>
			<title><![CDATA[垂直搜索逐步实现行业应用]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[搜索引擎]]></category>
			<pubDate>Fri,07 Jan 2011 17:48:17 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=138</guid>	
		<description><![CDATA[&nbsp;&nbsp;&nbsp;根据统计，53%的购物用户都会使用搜索引擎，而在这其中，越来越多的网购者习惯于使用购物网站提供的垂直搜索服务。对此，有业内专家指出，随着人们生活节奏的加快，用户对信息精准度的要求越来越高，而通用搜索引擎提供的信息繁多，与用户的需求不对称，这种模糊搜索既费时又费力，无异于大海捞针。对此，诸如北京线点科技有限公司http：//www.xd-tech.com等行业名企纷纷将目光投到了垂直搜索引擎之上。<br/>在搜索领域中曾有句话，引擎无法精确知道用户要的是什么，除非用户已经找到了他想找的东西。这就是通用搜索当前遇到的问题。目前的市场对于商机和效率的要求也越来越强烈，以致越来越多的传统企业转身投奔电子商务经营。这也给电子商务服务商带来了新的机遇和挑战。据悉，北京线点科技有限公司提供的垂直搜索引擎，通过与各行业企业合作，可以将传统企业的资源和知识与电子商务深度结合，使用户可以在海量的供求信息中，快速的筛选出最合适、最合理、最经济的搜索结果，从而节省时间、节约成本。且能更大范围的将企业推广至所有上下游提供商、求购商。实现最大限度的推广营销。同时，作为垂直搜索引擎，各个不同行业之间将不会产生业务冲突，这在很大程度上避免了各行业争夺搜索页面的情况。&nbsp;<br/>　垂直搜索专、精、深的特点，决定了基于专业的细分化发展潜力。如果将通用搜索引擎比作筛子，那么垂直搜索引擎依然是筛子，只不过筛子眼缩小了千倍、万倍。以应用线点科技有限公司垂直搜索引擎所打造的股票搜索“搜股易<a href="http://www.sougue.com" target="_blank">http://www.sougue.com</a>&nbsp;/”为例，用户搜索关键字时，其结果只专注于股票方面的，避免了其他毫无关联的搜索结果。&nbsp;<br/>　有资深专家指出，如今互联网不断的在与垂直领域进行结合，通过北京线点科技有限公司等重量级企业的深入发掘，当下中国在垂直搜索领域已经逐渐找到了拓展方向，其增长速度和经营态势都已经趋于成熟。较之垂直搜索在面向特定行业中的商务应用价值，通用搜索更像是一个“和声”，只有用户将二者充分变通的有效利用，才可实现理想中的工作生活两不误。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=137</link>
			<title><![CDATA[网络舆情的重要性（最新）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,28 Dec 2010 09:53:53 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=137</guid>	
		<description><![CDATA[网络舆情的重要性（最新）<br/>网络舆论的巨大力量及相关责任部门应对不力而产生的负面影响让全社会，特别是政府及相关公共事务管理部门认识到网络舆情服务的重要性。2010年，我国的网民人数突破了4亿大关，网络舆情越来越受到各方重视，一批提供网络舆情监测、整合、研判服务的专业机构应时而生。<br/>网络舆情服务机构可分四类<br/>目前，市场上的网络舆情服务机构大致可以分为四类：第一类由软件公司和传统的市场调查公司成立，技术实力较为雄厚，抓取网络舆情数据能力较强。第二类依托主流媒体，如人民网舆情监测室，对时事热点和受众心理变化的敏感度较高。第三类背靠高校或学术机构，如中国人民大学舆论研究所。这类机构具有学术传统，善于将网络舆情的变化和特点归纳、梳理，总结一般规律。第四类则由政府部门自身成立，主要监测群众对本地区、本部门工作的反馈。后三类机构都和政府或多或少存在一定联系，这和中国网络舆情服务行业的兴起背景有重要的关系。中国社会处于转型期，矛盾集中，传统的民意表达渠道不够畅通。而新媒体技术的发展使社会进入“大众麦克风时代”，网络舆情监测也就成为了了解民意的重要手段。中国的网络舆情服务行业从发展之初就承担着反映真实民意，为政府实施公共事务管理提供参考的责任。<br/>网络舆情服务≠“监测”+“删帖”<br/>一般大众对于网络舆情监测行业和机构的认识存在两个误区：一是认为网络舆情服务，重在“监测”。其实，网络舆情服务重要的不在于数据的抓取和搜集，更重要的是在一件事情发生后，对网络民意的有效数据进行科学筛选、量化统计和分析研判，并就如何应对，提出科学的咨询和建议，这才是网络舆情服务机构的核心价值所在。网络舆情监测、整合是高度人机合一的工作，如果只通过机械地抓取数据来获得信息，必然容易造成误判。汉语的表达方式复杂多样，网络上还存在一些片面的个人意见、情绪化的表达，这些都必须通过人为分析加以筛选。第二个误区，就是将网络舆情监测误认为“网络监控”。对此，李未柠表示，网络舆情监测行业和机构是以第三方的身份进行观察，提供客观、中立的意见，希望成为客户的智囊和顾问。是将事件各方视为平等媒介主体，通过搭建适当的沟通渠道消除误解，解决问题。<br/>网络舆情应对是政府必修课<br/><br/>　　对政府部门而言，在对网络舆情监测结果进行客观分析之前，有一个非常重要的环节不能忽略，这就是研究、论证。所有舆情服务机构的调查结果，都是政府了解民意不可或缺的渠道，但是其调查结论只有经过相互补充、印证，经过“去伪存真”&nbsp;的分析鉴别才有意义，才具有决策参考价值。政府的决策实施(或危机应对)过程一旦开始，就要明确目标和方向，不受单方面舆情调查结果的影响。只要决策是科学的，是符合大多数人的利益的，就要稳住阵脚，不能被概念中的“舆情”牵着鼻子走。<br/>政府要以主渠道强大的信息攻势，去影响公众，纠正畸变的舆论。很多情况下，人们产生听信谣传的倾向和从众行为，是因为得不到来自政府方面的权威信息，或者信息太弱。因此，对于政府而言，如何在发现某种舆论动向的同时，以足够量的、优质的信息来影响公众，引导舆论，是一门需要认真对待的必修课。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=136</link>
			<title><![CDATA[全文检索和数据库应用最大的不同]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[全文检索]]></category>
			<pubDate>Wed,15 Dec 2010 13:49:09 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=136</guid>	
		<description><![CDATA[<br/>全文检索和数据库应用最大的不同在于：让最相关的头100条结果满足98%以上用户的需求<br/><br/>Lucene的创新之处：<br/>大部分的搜索（数据库）引擎都是用B树结构来维护索引，索引的更新会导致大量的IO操作，Lucene在实现中，对此稍微有所改进：不是维护一个索引文件，而是在扩展索引的时候不断创建新的索引文件，然后定期的把这些新的小索引文件合并到原先的大索引中（针对不同的更新策略，批次的大小可以调整），这样在不影响检索的效率的前提下，提高了索引的效率。<br/>Lucene和其他一些全文检索系统/应用的比较：<br/>　&#160;&#160;&#160;&#160;Lucene&#160;&#160;&#160;&#160;其他开源全文检索系统<br/>增量索引和批量索引&#160;&#160;&#160;&#160;可以进行增量的索引(Append)，可以对于大量数据进行批量索引，并且接口设计用于优化批量索引和小批量的增量索引。&#160;&#160;&#160;&#160;很多系统只支持批量的索引，有时数据源有一点增加也需要重建索引。<br/>数据源&#160;&#160;&#160;&#160;Lucene没有定义具体的数据源，而是一个文档的结构，因此可以非常灵活的适应各种应用（只要前端有合适的转换器把数据源转换成相应结构），&#160;&#160;&#160;&#160;很多系统只针对网页，缺乏其他格式文档的灵活性。<br/>索引内容抓取&#160;&#160;&#160;&#160;Lucene的文档是由多个字段组成的，甚至可以控制那些字段需要进行索引，那些字段不需要索引，近一步索引的字段也分为需要分词和不需要分词的类型：<br/>&nbsp;&nbsp;&nbsp;需要进行分词的索引，比如：标题，文章内容字段<br/>&nbsp;&nbsp;&nbsp;不需要进行分词的索引，比如：作者/日期字段&#160;&#160;&#160;&#160;缺乏通用性，往往将文档整个索引了<br/>语言分析&#160;&#160;&#160;&#160;通过语言分析器的不同扩展实现：<br/>可以过滤掉不需要的词：an&nbsp;the&nbsp;of&nbsp;等，<br/>西文语法分析：将jumps&nbsp;jumped&nbsp;jumper都归结成jump进行索引/检索<br/>非英文支持：对亚洲语言，阿拉伯语言的索引支持&#160;&#160;&#160;&#160;缺乏通用接口实现<br/>查询分析&#160;&#160;&#160;&#160;通过查询分析接口的实现，可以定制自己的查询语法规则：<br/>比如：&nbsp;多个关键词之间的&nbsp;+&nbsp;-&nbsp;and&nbsp;o&#114;关系等&#160;&#160;&#160;&#160;　<br/>并发访问&#160;&#160;&#160;&#160;能够支持多用户的使用&#160;&#160;&#160;&#160;　<br/>&nbsp;<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=135</link>
			<title><![CDATA[海量查询的数据优化（十六）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,06 Dec 2010 10:46:02 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=135</guid>	
		<description><![CDATA[<br/>四、聚集索引的重要性和如何选择聚集索引&nbsp;<br/><br/>在上一节的标题中，笔者写的是：实现小数据量和海量数据的通用分页显示存储过程。这是因为在将本存储过程应用于“办公自动化”系统的实践中时，笔者发现这第三种存储过程在小数据量的情况下，有如下现象：&nbsp;<br/><br/>1、分页速度一般维持在1秒和3秒之间。&nbsp;<br/><br/>2、在查询最后一页时，速度一般为5秒至8秒，哪怕分页总数只有3页或30万页。&nbsp;<br/><br/>虽然在超大容量情况下，这个分页的实现过程是很快的，但在分前几页时，这个1－3秒的速度比起第一种甚至没有经过优化的分页方法速度还要慢，借用户的话说就是“还没有ACCESS数据库速度快”，这个认识足以导致用户放弃使用您开发的系统。&nbsp;<br/><br/>笔者就此分析了一下，原来产生这种现象的症结是如此的简单，但又如此的重要：排序的字段不是聚集索引！&nbsp;<br/><br/>本篇文章的题目是：“查询优化及分页算法方案”。笔者只所以把“查询优化”和“分页算法”这两个联系不是很大的论题放在一起，就是因为二者都需要一个非常重要的东西――聚集索引。&nbsp;<br/><br/>在前面的讨论中我们已经提到了，聚集索引有两个最大的优势：&nbsp;<br/><br/>1、以最快的速度缩小查询范围。&nbsp;<br/><br/>2、以最快的速度进行字段排序。&nbsp;<br/><br/>第1条多用在查询优化时，而第2条多用在进行分页时的数据排序。&nbsp;<br/><br/>而聚集索引在每个表内又只能建立一个，这使得聚集索引显得更加的重要。聚集索引的挑选可以说是实现“查询优化”和“高效分页”的最关键因素。&nbsp;<br/><br/>但要既使聚集索引列既符合查询列的需要，又符合排序列的需要，这通常是一个矛盾。&nbsp;<br/><br/>笔者前面“索引”的讨论中，将fariqi，即用户发文日期作为了聚集索引的起始列，日期的精确度为“日”。这种作法的优点，前面已经提到了，在进行划时间段的快速查询中，比用ID主键列有很大的优势。&nbsp;<br/><br/>但在分页时，由于这个聚集索引列存在着重复记录，所以无法使用max或min来最为分页的参照物，进而无法实现更为高效的排序。而如果将ID主键列作为聚集索引，那么聚集索引除了用以排序之外，没有任何用处，实际上是浪费了聚集索引这个宝贵的资源。&nbsp;<br/><br/>为解决这个矛盾，笔者后来又添加了一个日期列，其默认值为getdate()。用户在写入记录时，这个列自动写入当时的时间，时间精确到毫秒。即使这样，为了避免可能性很小的重合，还要在此列上创建UNIQUE约束。将此日期列作为聚集索引列。&nbsp;<br/><br/>有了这个时间型聚集索引列之后，用户就既可以用这个列查找用户在插入数据时的某个时间段的查询，又可以作为唯一列来实现max或min，成为分页算法的参照物。&nbsp;<br/><br/>经过这样的优化，笔者发现，无论是大数据量的情况下还是小数据量的情况下，分页速度一般都是几十毫秒，甚至0毫秒。而用日期段缩小范围的查询速度比原来也没有任何迟钝。&nbsp;<br/><br/>聚集索引是如此的重要和珍贵，所以我总结了一下，一定要将聚集索引建立在：&nbsp;<br/><br/>1、您最频繁使用的、用以缩小查询范围的字段上；&nbsp;<br/><br/>2、您最频繁使用的、需要排序的字段上。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=134</link>
			<title><![CDATA[海量查询的数据优化（十五）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Thu,25 Nov 2010 10:53:56 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=134</guid>	
		<description><![CDATA[<br/>--以下代码赋予了@strSQL以真正执行的SQL代码&nbsp;<br/><br/>set&nbsp;@strSQL&nbsp;=&nbsp;&#34;sel&#101;ct&nbsp;top&nbsp;&#34;&nbsp;+&nbsp;str(@PageSize)&nbsp;+&#34;&nbsp;&#34;+@strGetFields+&nbsp;&#34;&nbsp;&nbsp;from&nbsp;[&#34;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&nbsp;wh&#101;re&nbsp;[&#34;&nbsp;+&nbsp;@fldName&nbsp;+&nbsp;&#34;]&#34;&nbsp;+&nbsp;@strTmp&nbsp;+&nbsp;&#34;([&#34;+&nbsp;@fldName&nbsp;+&nbsp;&#34;])&nbsp;from&nbsp;(sel&#101;ct&nbsp;top&nbsp;&#34;&nbsp;+&nbsp;str((@PageIndex-1)*@PageSize)&nbsp;+&nbsp;&#34;&nbsp;[&#34;+&nbsp;@fldName&nbsp;+&nbsp;&#34;]&nbsp;from&nbsp;[&#34;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&#34;&nbsp;+&nbsp;@strOrder&nbsp;+&nbsp;&#34;)&nbsp;as&nbsp;tblTmp)&#34;+&nbsp;@strOrder&nbsp;<br/><br/><br/><br/>if&nbsp;@strWh&#101;re&nbsp;!=&nbsp;&#39;&#39;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;@strSQL&nbsp;=&nbsp;&#34;sel&#101;ct&nbsp;top&nbsp;&#34;&nbsp;+&nbsp;str(@PageSize)&nbsp;+&#34;&nbsp;&#34;+@strGetFields+&nbsp;&#34;&nbsp;&nbsp;from&nbsp;[&#34;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&nbsp;wh&#101;re&nbsp;[&#34;&nbsp;+&nbsp;@fldName&nbsp;+&nbsp;&#34;]&#34;&nbsp;+&nbsp;@strTmp&nbsp;+&nbsp;&#34;([&#34;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;@fldName&nbsp;+&nbsp;&#34;])&nbsp;from&nbsp;(sel&#101;ct&nbsp;top&nbsp;&#34;&nbsp;+&nbsp;str((@PageIndex-1)*@PageSize)&nbsp;+&nbsp;&#34;&nbsp;[&#34;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;@fldName&nbsp;+&nbsp;&#34;]&nbsp;from&nbsp;[&#34;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&nbsp;wh&#101;re&nbsp;&#34;&nbsp;+&nbsp;@strWh&#101;re&nbsp;+&nbsp;&#34;&nbsp;&#34;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;@strOrder&nbsp;+&nbsp;&#34;)&nbsp;as&nbsp;tblTmp)&nbsp;and&nbsp;&#34;&nbsp;+&nbsp;@strWh&#101;re&nbsp;+&nbsp;&#34;&nbsp;&#34;&nbsp;+&nbsp;@strOrder&nbsp;<br/><br/>end&nbsp;<br/><br/>end&nbsp;&nbsp;<br/><br/>exec&nbsp;(@strSQL)&nbsp;<br/><br/>GO&nbsp;<br/><br/>上面的这个存储过程是一个通用的存储过程，其注释已写在其中了。&nbsp;<br/><br/>在大数据量的情况下，特别是在查询最后几页的时候，查询时间一般不会超过9秒；而用其他存储过程，在实践中就会导致超时，所以这个存储过程非常适用于大容量数据库的查询。&nbsp;<br/><br/>笔者希望能够通过对以上存储过程的解析，能给大家带来一定的启示，并给工作带来一定的效率提升，同时希望同行提出更优秀的实时数据分页算法。&nbsp;<br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=133</link>
			<title><![CDATA[海量查询的数据优化（十四）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,15 Nov 2010 09:45:07 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=133</guid>	
		<description><![CDATA[<br/>在确定了第三种分页方案后，我们可以据此写一个存储过程。大家知道SQL&nbsp;SERVER的存储过程是事先编译好的SQL语句，它的执行效率要比通过WEB页面传来的SQL语句的执行效率要高。下面的存储过程不仅含有分页方案，还会根据页面传来的参数来确定是否进行数据总数统计。&nbsp;--&nbsp;获取指定页的数据&nbsp;Cr&#101;ate&nbsp;PROCEDURE&nbsp;pagination3&nbsp;@tblName  &nbsp;varchar(255),      &nbsp;--&nbsp;表名&nbsp;@strGetFields&nbsp;varchar(1000)&nbsp;=&nbsp;&#39;*&#39;, &nbsp;--&nbsp;需要返回的列&nbsp;@fldName&nbsp;varchar(255)=&#39;&#39;,     &nbsp;--&nbsp;排序的字段名&nbsp;@PageSize  &nbsp;int&nbsp;=&nbsp;10,         &nbsp;--&nbsp;页尺寸&nbsp;@PageIndex &nbsp;int&nbsp;=&nbsp;1,          &nbsp;--&nbsp;页码&nbsp;@doCount &nbsp;bit&nbsp;=&nbsp;0,  &nbsp;--&nbsp;返回记录总数,&nbsp;非&nbsp;0&nbsp;值则返回&nbsp;@OrderType&nbsp;bit&nbsp;=&nbsp;0, &nbsp;--&nbsp;设置排序类型,&nbsp;非&nbsp;0&nbsp;值则降序&nbsp;@strWh&#101;re &nbsp;varchar(1500)&nbsp;=&nbsp;&#39;&#39; &nbsp;--&nbsp;查询条件&nbsp;(注意:&nbsp;不要加&nbsp;wh&#101;re)&nbsp;AS&nbsp;declare&nbsp;@strSQL  &nbsp;varchar(5000)      &nbsp;--&nbsp;主语句&nbsp;declare&nbsp;@strTmp  &nbsp;varchar(110)       &nbsp;--&nbsp;临时变量&nbsp;declare&nbsp;@strOrder&nbsp;varchar(400)       &nbsp;--&nbsp;排序类型&nbsp;if&nbsp;@doCount&nbsp;!=&nbsp;0&nbsp; &nbsp;begin&nbsp;   &nbsp;if&nbsp;@strWh&#101;re&nbsp;!=&#39;&#39;&nbsp;   &nbsp;set&nbsp;@strSQL&nbsp;=&nbsp;&#34;sel&#101;ct&nbsp;count(*)&nbsp;as&nbsp;Total&nbsp;from&nbsp;[&#34;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&nbsp;wh&#101;re&nbsp;&#34;+@strWh&#101;re&nbsp;   &nbsp;else&nbsp;   &nbsp;set&nbsp;@strSQL&nbsp;=&nbsp;&#34;sel&#101;ct&nbsp;count(*)&nbsp;as&nbsp;Total&nbsp;from&nbsp;[&#34;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&#34;&nbsp;end &nbsp;--以上代码的意思是如果@doCount传递过来的不是0，就执行总数统计。以下的所有代码都是@doCount为0的情况&nbsp;else&nbsp;begin&nbsp;if&nbsp;@OrderType&nbsp;!=&nbsp;0&nbsp;begin&nbsp;   &nbsp;set&nbsp;@strTmp&nbsp;=&nbsp;&#34;&lt;(sel&#101;ct&nbsp;min&#34;&nbsp;set&nbsp;@strOrder&nbsp;=&nbsp;&#34;&nbsp;o&#114;der&nbsp;by&nbsp;[&#34;&nbsp;+&nbsp;@fldName&nbsp;+&#34;]&nbsp;desc&#34;&nbsp;--如果@OrderType不是0，就执行降序，这句很重要！&nbsp;end&nbsp;else&nbsp;begin&nbsp;   &nbsp;set&nbsp;@strTmp&nbsp;=&nbsp;&#34;&gt;(sel&#101;ct&nbsp;max&#34;&nbsp;   &nbsp;set&nbsp;@strOrder&nbsp;=&nbsp;&#34;&nbsp;o&#114;der&nbsp;by&nbsp;[&#34;&nbsp;+&nbsp;@fldName&nbsp;+&#34;]&nbsp;asc&#34;&nbsp;end&nbsp;if&nbsp;@PageIndex&nbsp;=&nbsp;1&nbsp;begin&nbsp;   &nbsp;if&nbsp;@strWh&#101;re&nbsp;!=&nbsp;&#39;&#39; &nbsp;   &nbsp;set&nbsp;@strSQL&nbsp;=&nbsp;&#34;sel&#101;ct&nbsp;top&nbsp;&#34;&nbsp;+&nbsp;str(@PageSize)&nbsp;+&#34;&nbsp;&#34;+@strGetFields+&nbsp;&#34; &nbsp;from&nbsp;[&#34;&nbsp;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&nbsp;wh&#101;re&nbsp;&#34;&nbsp;+&nbsp;@strWh&#101;re&nbsp;+&nbsp;&#34;&nbsp;&#34;&nbsp;+&nbsp;@strOrder&nbsp;    &nbsp;else&nbsp;    &nbsp;set&nbsp;@strSQL&nbsp;=&nbsp;&#34;sel&#101;ct&nbsp;top&nbsp;&#34;&nbsp;+&nbsp;str(@PageSize)&nbsp;+&#34;&nbsp;&#34;+@strGetFields+&nbsp;&#34; &nbsp;from&nbsp;[&#34;+&nbsp;@tblName&nbsp;+&nbsp;&#34;]&nbsp;&#34;+&nbsp;@strOrder&nbsp;--如果是第一页就执行以上代码，这样会加快执行速度&nbsp;end&nbsp;else&nbsp;begin]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=132</link>
			<title><![CDATA[海量查询的数据优化（十三）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,02 Nov 2010 13:59:59 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=132</guid>	
		<description><![CDATA[我们知道，几乎任何字段，我们都可以通过max(字段)或min(字段)来提取某个字段中的最大或最小值，所以如果这个字段不重复，那么就可以利用这些不重复的字段的max或min作为分水岭，使其成为分页算法中分开每页的参照物。在这里，我们可以用操作符“&gt;”或“&lt;”号来完成这个使命，使查询语句符合SARG形式。如：&nbsp;Sel&#101;ct&nbsp;top&nbsp;10&nbsp;*&nbsp;from&nbsp;table1&nbsp;wh&#101;re&nbsp;id&gt;200&nbsp;于是就有了如下分页方案：&nbsp;sel&#101;ct&nbsp;top&nbsp;页大小&nbsp;*&nbsp;from&nbsp;table1&nbsp;wh&#101;re&nbsp;id&gt;&nbsp;     &nbsp;(sel&#101;ct&nbsp;max&nbsp;(id)&nbsp;from&nbsp;     &nbsp;(sel&#101;ct&nbsp;top&nbsp;((页码-1)*页大小)&nbsp;id&nbsp;from&nbsp;table1&nbsp;o&#114;der&nbsp;by&nbsp;id)&nbsp;as&nbsp;T&nbsp;      &nbsp;)   &nbsp; &nbsp;o&#114;der&nbsp;by&nbsp;id&nbsp;在选择即不重复值，又容易分辨大小的列时，我们通常会选择主键。下表列出了笔者用有着1000万数据的办公自动化系统中的表，在以GID（GID是主键，但并不是聚集索引。）为排序列、提取gid,fariqi,title字段，分别以第1、10、100、500、1000、1万、10万、25万、50万页为例，测试以上三种分页方案的执行速度：（单位：毫秒）&nbsp;页 &nbsp;码&nbsp;方案1&nbsp;方案2&nbsp;方案3&nbsp;1&nbsp;60&nbsp;30&nbsp;76&nbsp;10&nbsp;46&nbsp;16&nbsp;63&nbsp;100&nbsp;1076&nbsp;720&nbsp;130&nbsp;500&nbsp;540&nbsp;12943&nbsp;83&nbsp;1000&nbsp;17110&nbsp;470&nbsp;250&nbsp;1万&nbsp;24796&nbsp;4500&nbsp;140&nbsp;10万&nbsp;38326&nbsp;42283&nbsp;1553&nbsp;25万&nbsp;28140&nbsp;128720&nbsp;2330&nbsp;50万&nbsp;121686&nbsp;127846&nbsp;7168&nbsp;从上表中，我们可以看出，三种存储过程在执行100页以下的分页命令时，都是可以信任的，速度都很好。但第一种方案在执行分页1000页以上后，速度就降了下来。第二种方案大约是在执行分页1万页以上后速度开始降了下来。而第三种方案却始终没有大的降势，后劲仍然很足。&nbsp;]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=131</link>
			<title><![CDATA[海量查询的数据优化（十二）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Mon,25 Oct 2010 10:09:21 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=131</guid>	
		<description><![CDATA[笔者曾在网上看到了一篇小短文《从数据表中取出第n条到第m条的记录的方法》，全文如下：&nbsp;从publish&nbsp;表中取出第&nbsp;n&nbsp;条到第&nbsp;m&nbsp;条的记录：&nbsp;Sel&#101;ct&nbsp;TOP&nbsp;m-n+1&nbsp;*&nbsp;FROM&nbsp;publish&nbsp;Wh&#101;re&nbsp;(id&nbsp;NOT&nbsp;IN&nbsp;　　　　(Sel&#101;ct&nbsp;TOP&nbsp;n-1&nbsp;id&nbsp;　　　　&nbsp;FROM&nbsp;publish))&nbsp;id&nbsp;为publish&nbsp;表的关键字&nbsp;我当时看到这篇文章的时候，真的是精神为之一振，觉得思路非常得好。等到后来，我在作办公自动化系统（ASP.NET+&nbsp;C#＋SQL&nbsp;SERVER）的时候，忽然想起了这篇文章，我想如果把这个语句改造一下，这就可能是一个非常好的分页存储过程。于是我就满网上找这篇文章，没想到，文章还没找到，却找到了一篇根据此语句写的一个分页存储过程，这个存储过程也是目前较为流行的一种分页存储过程，我很后悔没有争先把这段文字改造成存储过程：&nbsp;Cr&#101;ate&nbsp;PROCEDURE&nbsp;pagination2&nbsp;(&nbsp;@SQL&nbsp;nVARCHAR(4000),   &nbsp;--不带排序语句的SQL语句&nbsp;@Page&nbsp;int,             &nbsp;--页码&nbsp;@RecsPerPage&nbsp;int,      &nbsp;--每页容纳的记录数&nbsp;@ID&nbsp;VARCHAR(255),      &nbsp;--需要排序的不重复的ID号&nbsp;@Sort&nbsp;VARCHAR(255)     &nbsp;--排序字段及规则&nbsp;)&nbsp;AS&nbsp;DECLARE&nbsp;@Str&nbsp;nVARCHAR(4000)&nbsp;SET&nbsp;@Str=&#39;Sel&#101;ct  &nbsp;TOP&nbsp;&#39;+CAST(@RecsPerPage&nbsp;AS&nbsp;VARCHAR(20))+&#39;&nbsp;*&nbsp;FROM&nbsp;(&#39;+@SQL+&#39;)&nbsp;T&nbsp;Wh&#101;re&nbsp;T.&#39;+@ID+&#39;NOT&nbsp;IN&nbsp;(Sel&#101;ct  &nbsp;TOP&nbsp;&#39;+CAST((@RecsPerPage*(@Page-1))&nbsp;AS&nbsp;VARCHAR(20))+&#39;&nbsp;&#39;+@ID+&#39;&nbsp;FROM&nbsp;(&#39;+@SQL+&#39;)&nbsp;T9&nbsp;o&#114;DER&nbsp;BY&nbsp;&#39;+@Sort+&#39;)&nbsp;o&#114;DER&nbsp;BY&nbsp;&#39;+@Sort&nbsp;PRINT&nbsp;@Str&nbsp;EXEC&nbsp;sp_ExecuteSql&nbsp;@Str&nbsp;GO&nbsp;其实，以上语句可以简化为：&nbsp;Sel&#101;ct&nbsp;TOP&nbsp;页大小&nbsp;*&nbsp;FROM&nbsp;Table1&nbsp;Wh&#101;re&nbsp;(ID&nbsp;NOT&nbsp;IN&nbsp;         &nbsp;(Sel&#101;ct&nbsp;TOP&nbsp;页大小*页数&nbsp;id&nbsp;        &nbsp;FROM&nbsp;表&nbsp;        &nbsp;o&#114;DER&nbsp;BY&nbsp;id))&nbsp;o&#114;DER&nbsp;BY&nbsp;ID&nbsp;但这个存储过程有一个致命的缺点，就是它含有NOT&nbsp;IN字样。虽然我可以把它改造为：&nbsp;Sel&#101;ct&nbsp;TOP&nbsp;页大小&nbsp;*&nbsp;FROM&nbsp;Table1&nbsp;Wh&#101;re&nbsp;not&nbsp;exists&nbsp;(sel&#101;ct&nbsp;*&nbsp;from&nbsp;(sel&#101;ct&nbsp;top&nbsp;(页大小*页数)&nbsp;*&nbsp;from&nbsp;table1&nbsp;o&#114;der&nbsp;by&nbsp;id)&nbsp;b&nbsp;wh&#101;re&nbsp;b.id=a.id&nbsp;)&nbsp;o&#114;der&nbsp;by&nbsp;id&nbsp;即，用not&nbsp;exists来代替not&nbsp;in，但我们前面已经谈过了，二者的执行效率实际上是没有区别的。&nbsp;既便如此，用TOP&nbsp;结合NOT&nbsp;IN的这个方法还是比用游标要来得快一些。&nbsp;虽然用not&nbsp;exists并不能挽救上个存储过程的效率，但使用SQL&nbsp;SERVER中的TOP关键字却是一个非常明智的选择。因为分页优化的最终目的就是避免产生过大的记录集，而我们在前面也已经提到了TOP的优势，通过TOP&nbsp;即可实现对数据量的控制。&nbsp;在分页算法中，影响我们查询速度的关键因素有两点：TOP和NOT&nbsp;IN。TOP可以提高我们的查询速度，而NOT&nbsp;IN会减慢我们的查询速度，所以要提高我们整个分页算法的速度，就要彻底改造NOT&nbsp;IN，同其他方法来替代它。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=130</link>
			<title><![CDATA[海量查询的数据优化（十一）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Sat,09 Oct 2010 10:47:42 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=130</guid>	
		<description><![CDATA[12、高效的TOP&nbsp;事实上，在查询和提取超大容量的数据集时，影响数据库响应时间的最大因素不是数据查找，而是物理的I/0操作。如：&nbsp;sel&#101;ct&nbsp;top&nbsp;10&nbsp;*&nbsp;from&nbsp;(&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,title&nbsp;from&nbsp;tgongwen&nbsp;wh&#101;re&nbsp;neibuyonghu=&#39;办公室&#39;&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;desc)&nbsp;as&nbsp;a&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;asc&nbsp;这条语句，从理论上讲，整条语句的执行时间应该比子句的执行时间长，但事实相反。因为，子句执行后返回的是10000条记录，而整条语句仅返回10条语句，所以影响数据库响应时间最大的因素是物理I/O操作。而限制物理I/O操作此处的最有效方法之一就是使用TOP关键词了。TOP关键词是SQL&nbsp;SERVER中经过系统优化过的一个用来提取前几条或前几个百分比数据的词。经笔者在实践中的应用，发现TOP确实很好用，效率也很高。但这个词在另外一个大型数据库ORACLE中却没有，这不能说不是一个遗憾，虽然在ORACLE中可以用其他方法（如：rownumber）来解决。在以后的关于“实现千万级数据的分页显示存储过程”的讨论中，我们就将用到TOP这个关键词。&nbsp;到此为止，我们上面讨论了如何实现从大容量的数据库中快速地查询出您所需要的数据方法。当然，我们介绍的这些方法都是“软”方法，在实践中，我们还要考虑各种“硬”因素，如：网络性能、服务器的性能、操作系统的性能，甚至网卡、交换机等。&nbsp;三、实现小数据量和海量数据的通用分页显示存储过程&nbsp;建立一个web&nbsp;应用，分页浏览功能必不可少。这个问题是数据库处理中十分常见的问题。经典的数据分页方法是:ADO&nbsp;纪录集分页法，也就是利用ADO自带的分页功能（利用游标）来实现分页。但这种分页方法仅适用于较小数据量的情形，因为游标本身有缺点：游标是存放在内存中，很费内存。游标一建立，就将相关的记录锁住，直到取消游标。游标提供了对特定集合中逐行扫描的手段，一般使用游标来逐行遍历数据，根据取出数据条件的不同进行不同的操作。而对于多表和大表中定义的游标（大的数据集合）循环很容易使程序进入一个漫长的等待甚至死机。&nbsp;更重要的是，对于非常大的数据模型而言，分页检索时，如果按照传统的每次都加载整个数据源的方法是非常浪费资源的。现在流行的分页方法一般是检索页面大小的块区的数据，而非检索所有的数据，然后单步执行当前行。&nbsp;   &nbsp;最早较好地实现这种根据页面大小和页码来提取数据的方法大概就是“俄罗斯存储过程”。这个存储过程用了游标，由于游标的局限性，所以这个方法并没有得到大家的普遍认可。&nbsp;后来，网上有人改造了此存储过程，下面的存储过程就是结合我们的办公自动化实例写的分页存储过程：&nbsp;Cr&#101;ate&nbsp;procedure&nbsp;pagination1&nbsp;(@pagesize&nbsp;int, &nbsp;--页面大小，如每页存储20条记录&nbsp;@pageindex&nbsp;int  &nbsp;--当前页码&nbsp;)&nbsp;as&nbsp;set&nbsp;nocount&nbsp;on&nbsp;begin&nbsp;declare&nbsp;@indextable&nbsp;table(id&nbsp;int&nbsp;identity(1,1),nid&nbsp;int) &nbsp;--定义表变量&nbsp;declare&nbsp;@PageLowerBound&nbsp;int &nbsp;--定义此页的底码&nbsp;declare&nbsp;@PageUpperBound&nbsp;int &nbsp;--定义此页的顶码&nbsp;set&nbsp;@PageLowerBound=(@pageindex-1)*@pagesize&nbsp;set&nbsp;@PageUpperBound=@PageLowerBound+@pagesize&nbsp;set&nbsp;rowcount&nbsp;@PageUpperBound&nbsp;ins&#101;rt&nbsp;into&nbsp;@indextable(nid)&nbsp;sel&#101;ct&nbsp;gid&nbsp;from&nbsp;TGongwen&nbsp;wh&#101;re&nbsp;fariqi&nbsp;&gt;dateadd(day,-365,getdate())&nbsp;o&#114;der&nbsp;by&nbsp;fariqi&nbsp;desc&nbsp;sel&#101;ct&nbsp;O.gid,O.mid,O.title,O.fadanwei,O.fariqi&nbsp;from&nbsp;TGongwen&nbsp;O,@indextable&nbsp;t&nbsp;wh&#101;re&nbsp;O.gid=t.nid&nbsp;and&nbsp;t.id&gt;@PageLowerBound&nbsp;and&nbsp;t.id&lt;=@PageUpperBound&nbsp;o&#114;der&nbsp;by&nbsp;t.id&nbsp;end&nbsp;set&nbsp;nocount&nbsp;off&nbsp;以上存储过程运用了SQL&nbsp;SERVER的最新技术――表变量。应该说这个存储过程也是一个非常优秀的分页存储过程。当然，在这个过程中，您也可以把其中的表变量写成临时表：Cr&#101;ate&nbsp;TABLE&nbsp;#Temp。但很明显，在SQL&nbsp;SERVER中，用临时表是没有用表变量快的。所以笔者刚开始使用这个存储过程时，感觉非常的不错，速度也比原来的ADO的好。但后来，我又发现了比此方法更好的方法。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=129</link>
			<title><![CDATA[海量查询的数据优化（十）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Tue,28 Sep 2010 14:43:09 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=129</guid>	
		<description><![CDATA[10、count(*)不比count(字段)慢&nbsp;某些资料上说：用*会统计所有列，显然要比一个世界的列名效率低。这种说法其实是没有根据的。我们来看：&nbsp;sel&#101;ct&nbsp;count(*)&nbsp;from&nbsp;Tgongwen&nbsp;用时：1500毫秒&nbsp;sel&#101;ct&nbsp;count(gid)&nbsp;from&nbsp;Tgongwen&nbsp;用时：1483毫秒&nbsp;sel&#101;ct&nbsp;count(fariqi)&nbsp;from&nbsp;Tgongwen&nbsp;用时：3140毫秒&nbsp;sel&#101;ct&nbsp;count(title)&nbsp;from&nbsp;Tgongwen&nbsp;用时：52050毫秒&nbsp;从以上可以看出，如果用count(*)和用count(主键)的速度是相当的，而count(*)却比其他任何除主键以外的字段汇总速度要快，而且字段越长，汇总的速度就越慢。我想，如果用count(*)，&nbsp;SQL&nbsp;SERVER可能会自动查找最小字段来汇总的。当然，如果您直接写count(主键)将会来的更直接些。&nbsp;11、order&nbsp;by按聚集索引列排序效率最高&nbsp;我们来看：（gid是主键，fariqi是聚合索引列）&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,reader,title&nbsp;from&nbsp;tgongwen&nbsp;用时：196&nbsp;毫秒。&nbsp;扫描计数&nbsp;1，逻辑读&nbsp;289&nbsp;次，物理读&nbsp;1&nbsp;次，预读&nbsp;1527&nbsp;次。&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,reader,title&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;asc&nbsp;用时：4720毫秒。&nbsp;扫描计数&nbsp;1，逻辑读&nbsp;41956&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;1287&nbsp;次。&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,reader,title&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;desc&nbsp;用时：4736毫秒。&nbsp;扫描计数&nbsp;1，逻辑读&nbsp;55350&nbsp;次，物理读&nbsp;10&nbsp;次，预读&nbsp;775&nbsp;次。&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,reader,title&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;fariqi&nbsp;asc&nbsp;用时：173毫秒。&nbsp;扫描计数&nbsp;1，逻辑读&nbsp;290&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,reader,title&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;fariqi&nbsp;desc&nbsp;用时：156毫秒。&nbsp;扫描计数&nbsp;1，逻辑读&nbsp;289&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;从以上我们可以看出，不排序的速度以及逻辑读次数都是和“order&nbsp;by&nbsp;聚集索引列”&nbsp;的速度是相当的，但这些都比“order&nbsp;by&nbsp;非聚集索引列”的查询速度是快得多的。&nbsp;同时，按照某个字段进行排序的时候，无论是正序还是倒序，速度是基本相当的。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=128</link>
			<title><![CDATA[海量查询的数据优化（九）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Sun,19 Sep 2010 16:38:12 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=128</guid>	
		<description><![CDATA[<br/>8、union并不绝对比or的执行效率高&nbsp;我们前面已经谈到了在wh&#101;re子句中使用or会引起全表扫描，一般的，我所见过的资料都是推荐这里用union来代替or。事实证明，这种说法对于大部分都是适用的。&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;o&#114;&nbsp;gid&gt;9990000&nbsp;用时：68秒。扫描计数&nbsp;1，逻辑读&nbsp;404008&nbsp;次，物理读&nbsp;283&nbsp;次，预读&nbsp;392163&nbsp;次。&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;union&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re&nbsp;gid&gt;9990000&nbsp;用时：9秒。扫描计数&nbsp;8，逻辑读&nbsp;67489&nbsp;次，物理读&nbsp;216&nbsp;次，预读&nbsp;7499&nbsp;次。&nbsp;看来，用union在通常情况下比用or的效率要高的多。&nbsp;但经过试验，笔者发现如果or两边的查询列是一样的话，那么用union则反倒和用or的执行速度差很多，虽然这里union扫描的是索引，而or扫描的是全表。&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;o&#114;&nbsp;fariqi=&#39;2004-2-5&#39;&nbsp;用时：6423毫秒。扫描计数&nbsp;2，逻辑读&nbsp;14726&nbsp;次，物理读&nbsp;1&nbsp;次，预读&nbsp;7176&nbsp;次。&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;union&nbsp;sel&#101;ct&nbsp;gid,fariqi,neibuyonghu,reader,title&nbsp;from&nbsp;Tgongwen&nbsp;wh&#101;re &nbsp;fariqi=&#39;2004-2-5&#39;&nbsp;用时：11640毫秒。扫描计数&nbsp;8，逻辑读&nbsp;14806&nbsp;次，物理读&nbsp;108&nbsp;次，预读&nbsp;1144&nbsp;次。&nbsp;9、字段提取要按照“需多少、提多少”的原则，避免“sel&#101;ct&nbsp;*”&nbsp;我们来做一个试验：&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,reader,title&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;desc&nbsp;用时：4673毫秒&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi,title&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;desc&nbsp;用时：1376毫秒&nbsp;sel&#101;ct&nbsp;top&nbsp;10000&nbsp;gid,fariqi&nbsp;from&nbsp;tgongwen&nbsp;o&#114;der&nbsp;by&nbsp;gid&nbsp;desc&nbsp;用时：80毫秒&nbsp;由此看来，我们每少提取一个字段，数据的提取速度就会有相应的提升。提升的速度还要看您舍弃的字段的大小来判断。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=127</link>
			<title><![CDATA[海量查询的数据优化（八）]]></title>
			<author>webmaster@xd-tech.com(baijl)</author>
			<category><![CDATA[其他]]></category>
			<pubDate>Wed,08 Sep 2010 11:33:10 +0800</pubDate>
			<guid>http://www.xd-tech.com/blog/default.asp?id=127</guid>	
		<description><![CDATA[<br/>很多资料上都显示说，exists要比in的执行效率要高，同时应尽可能的用not&nbsp;exists来代替not&nbsp;in。但事实上，我试验了一下，发现二者无论是前面带不带not，二者之间的执行效率都是一样的。因为涉及子查询，我们试验这次用SQL&nbsp;SERVER自带的pubs数据库。运行前我们可以把SQL&nbsp;SERVER的statistics&nbsp;I/O状态打开。&nbsp;（1）sel&#101;ct&nbsp;title,price&nbsp;from&nbsp;titles&nbsp;wh&#101;re&nbsp;title_id&nbsp;in&nbsp;(sel&#101;ct&nbsp;title_id&nbsp;from&nbsp;sales&nbsp;wh&#101;re&nbsp;qty&gt;30)&nbsp;该句的执行结果为：&nbsp;表&nbsp;&#39;sales&#39;。扫描计数&nbsp;18，逻辑读&nbsp;56&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;表&nbsp;&#39;titles&#39;。扫描计数&nbsp;1，逻辑读&nbsp;2&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;  &nbsp;（2）sel&#101;ct&nbsp;title,price&nbsp;from&nbsp;titles&nbsp;wh&#101;re&nbsp;exists&nbsp;(sel&#101;ct&nbsp;*&nbsp;from&nbsp;sales&nbsp;wh&#101;re&nbsp;sales.title_id=titles.title_id&nbsp;and&nbsp;qty&gt;30)&nbsp;第二句的执行结果为：&nbsp;表&nbsp;&#39;sales&#39;。扫描计数&nbsp;18，逻辑读&nbsp;56&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;表&nbsp;&#39;titles&#39;。扫描计数&nbsp;1，逻辑读&nbsp;2&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;我们从此可以看到用exists和用in的执行效率是一样的。&nbsp;7、用函数charindex()和前面加通配符%的LIKE执行效率一样&nbsp;前面，我们谈到，如果在LIKE前面加上通配符%，那么将会引起全表扫描，所以其执行效率是低下的。但有的资料介绍说，用函数charindex()来代替LIKE速度会有大的提升，经我试验，发现这种说明也是错误的：&nbsp;sel&#101;ct&nbsp;gid,title,fariqi,reader&nbsp;from&nbsp;tgongwen&nbsp;wh&#101;re&nbsp;charindex(&#39;刑侦支队&#39;,reader)&gt;0&nbsp;and&nbsp;fariqi&gt;&#39;2004-5-5&#39;&nbsp;用时：7秒，另外：扫描计数&nbsp;4，逻辑读&nbsp;7155&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。&nbsp;sel&#101;ct&nbsp;gid,title,fariqi,reader&nbsp;from&nbsp;tgongwen&nbsp;wh&#101;re&nbsp;reader&nbsp;like&nbsp;&#39;%&#39;&nbsp;+&nbsp;&#39;刑侦支队&#39;&nbsp;+&nbsp;&#39;%&#39;&nbsp;and&nbsp;fariqi&gt;&#39;2004-5-5&#39;&nbsp;用时：7秒，另外：扫描计数&nbsp;4，逻辑读&nbsp;7155&nbsp;次，物理读&nbsp;0&nbsp;次，预读&nbsp;0&nbsp;次。]]></description>
		</item>
		
			<item>
			<link>http://www.xd-tech.com/blog/default.asp?id=126</link>
			<title><![CDATA[富基旋风移动营销平台]]></title>
			<author>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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>webmaster@xd-tech.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之类工具建模经验的朋友们应该知道，在构造某一事物的时候，最先需要对这一事物的特征进行分析，确定好坐标，然后进行构造。不管后面用什么场景来渲染，所建的模都是一样的。比如茶壶，有自己特有的曲线，还有人的脸，一些坐标是相对固定的，不管这个人是年轻，还是变老，这些特征都是无法改变的。所以如果可以采集到足够的“语料”，对搜索引擎进行训练，那么随着训练的进行，搜索引擎认识的东西也就
