ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
AJAX LUCENE ¹¹½¨ËÑË÷ÒýÇæ Roger Xia
Ajax & Lucene Ajax Google Suggest  ÌáʾÐÅÏ¢ Google Map  Ëõ·Å£¬ÍÏק ÍøÒ³ÏìÓ¦Ëٶȸü¿ì£¬¿ÉÒÔÍ϶¯£¬Òì²½´¦Àí Lucene µ±Ç°ÉÌÒµÐÍÏîÄ¿Öж¼ÐèÒªÓÐËÑË÷µÄ¹¦ÄÜ ÓÐЩ¿ÉÒÔͨ¹ý SQL À´ÊµÏÖËÑË÷ ¶ÔÓÚÈ«ÎļìË÷£¨Èç¶ÔÒ»¸ö¹«Ë¾ 5 ÄêÀ´ËùÓб¨±íÊý¾ÝºÍ»áÒé¼Ç¼µÄËÑË÷£©£¬Êý¾Ý¿âµÄËٶȺÍÐÔÄÜÎÞ·¨Âú×ãÐèÇó ¹ºÂò Google µÈ¹«Ë¾µÄËÑË÷·þÎñ ×Ô¼º¿ª·¢ËÑË÷ÒýÇæ  ebay ¡­ ʹÓà Apache ¿ªÔ´È«ÎļìË÷¹¤¾ß°ü Lucene ·½±ãµØ¹¹½¨×Ô¼ºµÄËÑË÷ÒýÇæ Eclipse ¾ÍÊÇʹÓà Lucene ×÷ΪÆäÄÚ½¨µÄËÑË÷¹¤¾ß
AJAX = Asynchronous +  JavaScript  + XML + CSS ä¯ÀÀÆ÷µÄ JavaScript ¶ÔÏóÄ£ÐÍ Location ¶ÔÏ󣺷ÃÎʼÓÔØÔÚ´°¿ÚÖеÄÎĵµµÄ URL £¬¿ÉÒÔÓà location ¶ÔÏó´Óµ±Ç°ÍøÒ³¶¨Î»µ½ÁíÒ»¸öÍøÒ³£¬ È磺 location.href=¡° http:// www. ¡± History ¶ÔÏ󣺲鿴×î½ü·ÃÎʹýµÄÍøÖ·ÁÐ±í£¬ È磺 history.go(), history.back()
JavaScript Object-based:  Ö±¹Û / Ä£¿é»¯ / ¿É¸´Óà JavaScript ²¢²»ÊÇÍêÈ«ÃæÏò¶ÔÏ󣨷â×° / ¸´ºÏ / ¼Ì³Ð / ¶à̬£¬µÈ£©µÄÓïÑÔ ×î¼òµ¥µÄ´´½¨ JavaScript ¶ÔÏóµÄ·½·¨£ºµ÷Óà Object ÀàµÄÄÚ½¨¹¹Ô캯Êý var myObject = new Object(); ´´½¨ÁËÒ»¸ö Object ÀàÐ͵ĶÔÏó myObject, myObject Ö»ÊÇÒ»¸ö¿ÕµÄ¶ÔÏó£¬Ã»ÓÐÈκÎÊôÐԺͷ½·¨¡£ JavaScript ¶ÔÏóÖ»ÊÇÒ»×é¹ØÁªµÄÊý×飬¶ÔÏóµÄÊôÐÔ ( ±äÁ¿ ) ºÍ·½·¨ ( º¯Êý ) ÊÇ¿ÉÒÔͨ¹ýÊý×éϱêºÍÃû×ÖÒýÓõġ£
JavaScript ¶ÔÏó ¿É¶Áд var person = new Object(); // ͨ¹ý¡° .¡± ¸ø¶ÔÏóÌí¼ÓÊôÐÔ person.name=¡°Roger¡±; person.sex=¡°male¡±;  // ͨ¹ýÊý×éϱêÒýÓà person[0]=¡°Roger¡±; person[1]=¡°male¡±; // ͨ¹ý×Ö·û´®ÊµÏÖ person[¡°name¡±]=¡°Roger¡±; person[¡°sex¡±]=¡°male¡±; ʹÓá° =¡± ²Ù×÷·û³ýÁË¿ÉÒÔÏò¶ÔÏóÌí¼Ó / ÐÞ¸ÄÊôÐÔ£¬»¹¿ÉÒÔ½«·½·¨¶¯Ì¬µØÌí¼Óµ½Ò»¸ö¶ÔÏó£¬È磺 person.sayHello = function() { alert(¡°Hello, my name is ¡± + this.name); }
ʹÓà JSON ´´½¨Êý×éºÍ¶ÔÏóͼ JavaScript ¶ÔÏóµÄijһ¸ö³ÉÔ±Ò²¿ÉÒÔÊÇÒ»¸ö¶ÔÏó ¶ÔÏó½á¹¹¸´ÔÓ ¿É¶ÁÐÔ / ¿Éά»¤ÐÔ²î JavaScript Object Notation ÊÇ JavaScript µÄºËÐÄÌØÐÔ var cookbook=new Object(); cookbook.pageCount=100; cookbook.author={ firstName: ¡°Harry¡±, secondName: ¡°Christmas¡±, birthdate: new Date(1900,2,29), interests: [¡°cheese¡±, ¡°basketball¡±, ¡°music¡±] }
JavaScript ¹¹Ô캯Êý function Person (name, age){ this.name=name; this.age=age; this.sayHello=function() { alert(¡°my name is ¡± + this.name); } } var myObj = new Person(¡°Roger¡±, 27); Java ÓïÑÔÖÐËùÓÐÀ඼¼Ì³Ð×Ô java.lang.Object Àà JavaScript ûÓÐ Java ÕâÖּ̳еĸÅÄËùÓÐ JavaScript ¶ÔÏó¶¼ÊÇͬһ¸ö»ùÀàµÄʵÀý£¬Õâ¸ö»ùÀàÓµÓÐÔÚÔËÐÐʱ½«³ÉÔ±º¯ÊýºÍ±äÁ¿¶¯Ì¬°î¶¨µ½×ÔÉíµÄÄÜÁ¦¡£ ÉÏÃæµÄ´úÂëȱµã£º a).  ¶ÔÓÚ´´½¨µÄÿһ¸ö Person ÀàµÄʵÀý£¬¶¼»á´´½¨Ò»¸öÐ嵀 sayHello º¯Êý£¬Õâ¶ÔÄÚ´æÊÇÒ»¸ö¼«´óµÄÀË·Ñ£¬Èç¹ûÔÚ³ÌÐòÖд´½¨´óÁ¿ÕâÑùµÄ¶ÔÏó£¬ÄÚ´æй¶ÎÊÌâ»á±äµÃÓÈΪÃ÷ÏÔ¡£ b).  ÔÚ¹¹Ô캯ÊýÖд´½¨Ò»¸ö±ÕºÏÇøÓò£¬ÔÚÉæ¼°µ½ DOM ʱ£¬½«»á²úÉúÑÏÖصÄÎÊÌâ¡£ ¸üΪ°²È«µÄÌæ´ú·½°¸£ºÍ¨¹ýʹÓà prototype ±äµÃ¸ü¼ÓÃæÏò¶ÔÏó»¯
JavaScript -- prototype ͨ¹ýʹÓù¹Ô캯ÊýµÄ prototype £¬ÊôÐÔºÍÐÐÊý¿ÉÒÔ¹ØÁªµ½¶ÔÏóÉÏ¡£ function Person (name, age){ this.name=name; this.age=age; } Person.prototype.sayHello=function() { alert(¡°my name is ¡± + this.name); } var myObj = new Person(¡°Roger¡±, 27); myObj.sayHello(); ×¢ÒâÖ´ÐÐ˳Ðò£ºÍ¨¹ý prototype Ïò JavaScript ¶ÔÏóÌí¼ÓµÄÊôÐԺͷ½·¨ÊÇÔÚ¹¹Ô캯Êýµ÷ÓõÄÄÇÒ»¿Ì¹ØÁªµ½Ëù´´½¨µÄ¶ÔÏóÉÏÈ¥µÄ ¡£
JavaScript ¶ÔÏó·´Éä È·¶¨¶ÔÏóÊÇ·ñÓÐij¸öÊôÐÔ£º if (typeof(myObject.someProperty) != ¡°undefined¡±){ ¡­¡­ } ²âÊÔij¸ö¶ÔÏóµÄÀàÐÍ instanceof if (myObj instanceof Array){ ¡­¡­ }
Rich Client ¡° ÅÖ¿Í»§¶Ë¡±£ºÏà¶ÔÓÚ¡°ÊÝ¿Í»§¶Ë¡±¶øÑÔ£¬ÔÚ¿Í»§»úÆ÷ÉÏ°²×°ÅäÖõÄÒ»¸ö¹¦ÄܷḻµÄ½»»¥Ê½Óû§½çÃæ¡£ MSN, IE, Oracle, DB2 Êý¾Ý¿â¹ÜÀí¹¤¾ß ´«Í³µÄ Web Ó¦ÓóÌÐò£º¿Í»§¶ËÐè½øÐÐÒ³ÃæÌøת»òˢРAjax ½â¾öÁË£º¸ºÔعý´ó£¬ÏìӦʱ¼ä³¤£¬Í¬²½½»»¥¹ý³Ì´øÀ´µÄ¸Ð¾õ²»Á¬¹á
Ajax ¼¼ÊõʹÓà XMLHTTPRequest ¶ÔÏó·¢ËÍÇëÇ󲢵õ½·þÎñÆ÷ÏìÓ¦£¬µÃµ½·µ»ØµÄÊý¾ÝºóÓà JavaScript ²Ù×÷ DOM À´Ê¹Ò³Ãæ¸üÐÂ
Cascading Style Sheets Óŵ㣺ÌṩÁË´ÓÄÚÈÝÖзÖÀëÓ¦ÓÃÑùʽºÍÉè¼ÆµÄ»úÖÆ È±µã£ºÊǹ¹½¨¿çä¯ÀÀÆ÷Ó¦ÓõÄÒ»´ó×è°­£¬²»Í¬µÄä¯ÀÀÆ÷³§ÉÌÖ§³Ö²»Í¬µÄ CSS ¼¶±ð¡£ Ëæ×Å XML µÄÒýÈ룬Êý¾ÝÃèÊö³ÉΪµ¥¶ÀµÄ¹¦ÄÜ£¬¶øÑùʽ±íÔò¸ºÔðÏÔʾ£¬ÄÚÈݺÍÑùʽµÄ·ÖÀë¸ø¿ª·¢´øÀ´µÄ¼«´óµØ·½±ã£º¿É¶ÁÐÔ£¬Ò»´ÎÐÔдÈë W3C ¶Ô CSS ±ê×¼µÄ¸Ä½ø£¬Óë¸÷ä¯ÀÀÆ÷°æ±¾¼æÈÝÐÔ
CSS Ñùʽ±íÓÉÑùʽ¹æÔò×é³É£¬Ñùʽ¹æÔò°üÀ¨£ºÑ¡Ôñ·ûºÍÑùʽ¶¨Òå Ñ¡Ôñ·û { ÊôÐÔ 1:  Öµ 1 £» /* ×¢ÊÍ */ ÊôÐÔ 2:  Öµ 2 } ÉêÃ÷·Ö×飬¼Ì³Ð
ÄÚ²¿Ñùʽ±í <html> <head><title> ÄÚ²¿Ñùʽ±íÑÝʾ </title> <style type=¡°text/css¡±> h1,h2,h3 { color: blue } /* Ñ¡Ôñ·û·Ö×é */ h1 { /* ÊôÐÔ·Ö×é */ font-weight: bold; font-size: 30pt; font-family:  ËÎÌå } h2 { /* ÊôÐÔÖµ·Ö×é */ font: bold 28pt  ËÎÌå } </style> </head> <body> ¡­¡­</body> </html>
ÍⲿÑùʽ±í Á½ÖÖʹÓ÷½Ê½£ºÁ¬½Óµ½Ñùʽ±íÉÏ£» ÊäÈëÑùʽ±í¡£ ===out.css=== body { background-color: pink }  p { margin-left: 20%; margin-right: 20%; font-family:  ËÎÌå ; font-size: 14 } <html> <head><title> Á´Ê½Ñùʽ±í </title> <link rel=stylesheet type=¡°text/css¡± href=¡°out.css¡±> </head> <body> ¡­¡­</body> </html> href ¿ÉÒÔÊÇÏà¶Ô·¾¶»ò¾ø¶Ô·¾¶ === ÊäÈëÍⲿÑùʽ±í @import ¿ÉÓëÆäËû·½·¨½áºÏʹÓã¬ÎĵµÖж¨ÒåµÄÆäËûÑùʽ±í¸ñÔò ½«¸²¸ÇÊäÈëÑùʽ±íÖÐ×÷ÓÃÔÚÏàͬ¶ÔÏóÉϵĹæÔò
ÑùʽÀà ÑùʽµÄ·ÖÀ࣬¿É¸ù¾Ý²»Í¬µÄ·ç¸ñÐèÒª¶ÔijһÀàÐ͵ıê¼ÇÉèÖü¸ÖÖ²»Í¬µÄ CSS ÊôÐÔ¡£ µÚÒ»ÖÖ¸ñʽ£º ±ê¼Ç . ÑùʽÀàÃû { ÊôÐÔ 1:  ÊôÐÔÖµ 1;  ÊôÐÔ 2:  ÊôÐÔÖµ 2;  ÊôÐÔ 3:  ÊôÐÔÖµ 3} µÚ¶þÖÖ¸ñʽ£º ÑùʽÀàÃû { ÊôÐÔ 1:  ÊôÐÔÖµ 1;  ÊôÐÔ 2:  ÊôÐÔÖµ 2;  ÊôÐÔ 3:  ÊôÐÔÖµ 3} µÚ¶þÖÖ·½Ê½¹æ¶¨µÄÑùʽÀàûÓÐÌض¨ÓÚijһÀà±ê¼Ç£¬ÈκÎÀàÐ͵ıê¼Ç¶¼¿ÉÒÔʹÓøÃÑùʽÀà¡£ ʹÓ㺠< ±ê¼Ç  class=¡° ÑùʽÀàÃû¡± >
CSS ÖеÄÂ˾µ filter: filtername (parameters) filter ÊÇÂ˾µÊôÐÔÑ¡Ôñ·û filtername ÊÇÂ˾µÊôÐÔÃû
DOM Óë JavaScript DHTML¡ª ʹÓà JavaScript ²Ù×÷Ò³ÃæÄÚÈݵĹý³Ì DOM¡ª Îĵµ¶ÔÏóÄ£ÐÍ£¬Äܹ»¸üºÃµÄ¿ØÖÆ´°¿ÚÄÚÈݵķ½·¨
ʹÓà JavaScript ¶ÁÈ¡ XML Îĵµ <basic country=¡°China¡±> <name num=¡°1¡±>
Ajax ¹¤×÷Á÷³Ì Ajax ÊÇʹÓÿͻ§¶Ë½Å±¾Óë Web ·þÎñÆ÷½»»»Êý¾ÝµÄ Web Ó¦Óÿª·¢·½·¨¡£ÕâÑù Web Ò³Ãæ²»Óôò¶Ï½»»¥Á÷³Ì½øÐÐÖØмÓÔØ£¬¾Í¿ÉÒÔ¶¯Ì¬µØ¸üС£ÓйØÊý¾ÝÑéÖ¤ºÍÊý¾Ý´¦Àí¶¼ÓÉ Ajax ÒýÇæÀ´×ö£¬ÐèÒª´Ó·þÎñÆ÷¶ÁÈ¡ÐÂÊý¾ÝʱÔÙÓÉ Ajax ÒýÇæ´úΪÏò·þÎñÆ÷Ìá½»ÇëÇó ʹÓà JavaScript ÖÐ XMLHttpRequest ¶ÔÏó£¨Ö§³ÖÒì²½ÇëÇóµÄ¼¼Êõ£©¿ÉÒÔÏò·þÎñÆ÷Ìá³öÇëÇó²¢´¦ÀíÏìÓ¦£¬Õâ¸ö¹ý³Ì²»»á×èÈûÓû§µÄÆäËû²Ù×÷¡£
ʹÓà XMLHttpRequest ·¢ËÍÇëÇóµÄ¹ý³Ì
¼àÊÓ Response µÄ״̬ ͨ¹ý»Øµ÷º¯Êý¡ª¼àÊÓä¯ÀÀÆ÷µÄ״̬  req.onreadystatechange = callback; // Ö¸¶¨»Øµ÷º¯Êý ²Ù×Ý·µ»ØµÄÊý¾Ý  req.responseText  req.responseXML function sendRequest(callback, url) { // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); // ´´½¨ XMLHttpRequest req.onreadystatechange = callback; // Ö¸¶¨»Øµ÷º¯Êý req.open(¡°GET¡±, url, true);  // ½¨Á¢ÇëÇó req.send(null); // ÈçÓвÎÊý£¬Ôò method ±ØÐëÊÇ post } // branch for IE/Windows ActiveX version else if (window.ActiveXObject) { req = new ActiveXObject(¡°Microsoft.XMLHTTP¡±); if (req) { ¡­¡­  //  ͬÉÏ } } } function callback() { if  (req.onreadystate == 4) { // ÅжϾÍÐ÷״̬ if (req.status == 200) { parseMessage();  // ½ÓÊÕ·µ»ØµÄÊý¾Ý } else { alert(¡°Not able to retrieve description¡± + req.statusText) ; } } else {} } function parseMessage() { var xmldoc = req.responseXML;  // »ñÈ¡·µ»ØµÄ½á¹û var name = xmldoc.getElementByTagName(¡°author¡±); // »ñÈ¡ÎļþÖÐ <author> ±ê¼Ç var content = document.getElementById(¡°display¡±); // »ñÈ¡ÍøÒ³ÖÐ <display> ±ê¼Ç content.innerHTML = name;  // ÔÚÍøÒ³ÖÐÏÔʾ }
Ajax ʵÀý ÌáʾµÈ´ý ¼¶ÁªÏÂÀ­¿ò Google suggest ºÝºÝߣr £¨»¬¿é£© ÌáʾµÈ´ý£º ÔÚ״ֵ̬²»µÈÓÚ 4 ʱ¶Ô HTML ´úÂë½øÐÐһЩÐ޸ģ¬ÈÃÒ³ÃæÏÔʾһЩÌáʾÐÅÏ¢¡£ ¼¶ÁªÏÂÀ­¿ò£º ¿Ø¼þ B µÄÄÚÈÝÈ¡¾öÓڿؼþ A µÄÄÚÈÝ£¬Çҿؼþ B µÄÄÚÈÝÐèÒª¸ù¾Ý¿Ø¼þ A µÄÄÚÈÝÔÙ´Ó·þÎñÆ÷¶Ë»ñµÃÏàÓ¦Êý¾Ý¡£ ÔÚ A µÄ  onChange  ʼþ·¢Éúʱµ÷ÓÃÒ»¸öº¯Êý£¬´´½¨ XMLHttpRequest ¶ÔÏóÀ´ºÍ·þÎñÆ÷½øÐн»»¥£¬Ïò·þÎñÆ÷·¢ËÍÇëÇ󣬲ÎÊýΪÏÂÀ­¿ò A ÖÐÑ¡¶¨µÄÄÚÈÝ¡£¿Í»§¶ËÔÚ½ÓÊÕµ½·þÎñÆ÷´¦ÀíºóµÄÊý¾Ýºó£¬ÏȶÔÊý¾Ý½øÐд¦Àí£¬ÔÙÏÔʾµ½ÏÂÀ­¿ò B ÖС£ »¬¿é  --  ÊÇÒ»¸ö¿ÉÒÔËæÒâÍ϶¯¶ø¸Ä±äÏàÓ¦ÖµµÄ¿Ø¼þ Í϶¯°´Å¥µÃµ½Ò»¸öеķ¶Î§ºó£¬¾Í´´½¨Ò»¸ö XMLHttpRequest ¶ÔÏóÀ´ºÍ·þÎñÆ÷½øÐн»»¥£¬²ÎÊý¾ÍÊÇ»¬¿éµ±Ç°Ö¸¶¨·¶Î§µÄ×îСֵºÍ×î´óÖµ¡£
Google suggest µ±ÔÚÎı¾¿òÖÐÊäÈë²éѯÄÚÈÝʱ£¬Îı¾¿ò¿Ø¼þ»áÏìÓ¦  onkeyup  ʼþ£¬ ÔÚÕâ¸öʼþÖе÷Óà javascript º¯ÊýÀ´´´½¨ XMLHttpRequest ¶ÔÏóºÍ·þÎñÆ÷½øÐн»»¥£¬Ïò·þÎñÆ÷·¢ËÍÇëÇ󣬲ÎÊýΪÎı¾¿òÖеÄÄÚÈÝ¡£·þÎñÆ÷½ÓÊÕµ½ÇëÇóºó£¬½«²ÎÊý×÷Ϊ²éѯÌõ¼þµÃµ½²éѯ½á¹û·µ»Øµ½¿Í»§¶Ë¡£¿Í»§¶Ë½ÓÊÕµ½ÕâЩ·µ»ØµÄÊý¾Ýºó£¬ÔÚÎı¾¿òÏ·½¹¹ÔìÒ»¸öÁÐ±í£¬À´ÏÔʾÕâЩƥÅä²éѯÌõ¼þµÄ¿ÉÑ¡Öµ¡£ÔÚÏÔʾ¹ý³ÌÖУ¬»¹Ðè¶ÔÓû§°´¼ü×ö³öһϵÁÐÅжϣ¬ÊµÏÖÓѺý»»¥¡£ ¶¨ÒåÑùʽÎļþ style.css ÓÃÀ´¿ØÖÆÏÂÀ­Ìáʾ¿ò¡¢Æ¥ÅäµÄÎı¾µÈµÄÏÔʾÑùʽ build.js
Ajax µÄ°²È«ÎÊÌâ Ajax µÄ°²È«ÎÊÌâºÍÐÔÄÜÎÊÌâ JavaScript ºÍä¯ÀÀÆ÷µÄ°²È«ÐÔ ¿Í»§¶Ë½Å±¾ÓïÑÔ£¨°²È«ÐÔÎÊÌ⣩  --  µ±·ÃÎÊÒ»¸öʹÓà Ajax ¼¼Êõ¹¹½¨µÄ Web Ó¦ÓÃʱ£¬ Web ·þÎñÆ÷»á½«Ò»ÏµÁÐ JavaScript ½Å±¾´úÂë·¢Ë͵½Ã¿Ò»¸ö·ÃÎÊÕߵĻúÆ÷ÉÏ£¬È»ºóÓû§ä¯ÀÀÆ÷±ã»áÔÚ±¾µØÖ´ÐÐÕâЩ´úÂë 1). JavaScript ÐÞ¸ÄϵͳÉèÖã¨×¢²á±í£¬¸ñʽ»¯Ó²ÅÌ£¬¶ñÒâÆÆ»µ£© 2). IFrame ÎÊÌ⣺ÍøÒ³ÖÐ IFrame Ö¸¶¨µÄÔªËØ¿ÉÒÔ´ÓÆäËûÓò¼ÓÔØÍøÒ³²¢Ö´ÐÐ HTML ´úÂ룬Ï൱ÓÚǶÔÚÍøÒ³ÄÚ²¿µÄÒ»¸ö¶ÀÁ¢¿ò¼Ü´°¿Ú£¬µ«²»Í¬ÓòµÄ JavaScript È´²»ÄÜ»¥Ïà·ÃÎÊ¡£
JavaScript µÄÐÔÄÜÎÊÌ⣨½âÊÍÐÍÓïÑÔ£© 1).  Ñ­»·£¬ ЧÂÊ£º while()  better than  for( ; ; )  better than  for( in )   ²éѯɢÁмü 2).  ¾Ö²¿±äÁ¿ ( ·ÅÔÚº¯ÊýµÄ¶ÑÕ»ÖÐ ) ·ÃÎÊËÙ¶È  better than  È«¾Ö±äÁ¿ 3).   ÉÙÓà eval £¬Ê¹Óà eval Ï൱ÓÚÔËÐÐʱÔٴε÷ÓýâÊÍÒýÇæ¶ÔÄÚÈݽøÐнâÊÍÔËÐС£¿ÉʹÓà JavaScript ±Õ°üʵÏÖÄ£°æ´úÌæ eval º¯Êý¡£ 4).  ʹÓþֲ¿±äÁ¿£¬¼õÉÙ¶ÔÏó²éÕÒ£¨½âÊÍÓïÑÔ£© var len = a.length; 5). s += a; better than s = s + a; s += a + b +c; better than s+=a; s+=b; s+=c; 6).  ÀàÐÍת»»£¨ÈõÀàÐÍ£©£¬ ( ¡°¡± + ) > String() > .toString() > new String() 7).  ʹÓÃÖ±½ÓÁ¿£¬ var foo = { };  ½âÊÍÒýÇæÖ±½Ó½âÊÍ  > var foo = new Object();  ÄÚ²¿¹¹ÔìÆ÷ var reg = /¡­/; faster than var reg = new RegExp() 8).  ¶Ô×Ö·û´®½øÐеÄÑ­»·²Ù×÷£¬ÈçÌæ»»¡¢²éÕÒ£¬Ó¦ÓÅÏÈʹÓÃÕýÔò±í´ïʽ£¨ C ÓïÑÔдµÄ API £© 9).  ¸´Óûò»º´æÒÔ¼õÉÙ´´½¨¸ß¼¶¶ÔÏó£¬È磺 Date ¡¢ RegExp 10).  Ö±½ÓʹÓÃϱê·ÃÎÊ¿ìÓÚʹÓá° .¡± 11).  ´´½¨ DOM ½Úµã£ºÊ¹ÓÃ×Ö·û´®Ö±½Óд HTML Óï¾äÀ´´´½¨½Úµã ЧÂʵÍÓÚ Ê¹Óà document.createElement() ·½·¨£¬ Èç¹ûÎĵµÖдæÔÚÏֳɵÄÑù°å½Úµã£¬¿ÉÒÔʹÓà cloneNode() À´¼õÉÙ¶à´ÎÉèÖÃÔªËصÄÊôÐÔ¡£
ËÑË÷ÒýÇæ¼Ü¹¹ --Lucene http://lucene.apache.org/ Roger Xia
µ±Ç°ÉÌÒµÐÍÏîÄ¿Öж¼ÐèÒªÓÐËÑË÷µÄ¹¦ÄÜ ÓÐЩ¿ÉÒÔͨ¹ý SQL À´ÊµÏÖËÑË÷ ¶ÔÓÚÈ«ÎļìË÷£¨Èç¶ÔÒ»¸ö¹«Ë¾ 5 ÄêÀ´ËùÓб¨±íÊý¾ÝºÍ»áÒé¼Ç¼µÄËÑË÷£©£¬Êý¾Ý¿âµÄËٶȺÍÐÔÄÜÎÞ·¨Âú×ãÐèÇó ¹ºÂò Google µÈ¹«Ë¾µÄËÑË÷·þÎñ ×Ô¼º¿ª·¢ËÑË÷ÒýÇæ  ebay ¡­ ʹÓà Apache ¿ªÔ´È«ÎļìË÷¹¤¾ß°ü Lucene ·½±ãµØ¹¹½¨×Ô¼ºµÄËÑË÷ÒýÇæ (Eclipse ¾ÍÊÇʹÓà Lucene ×÷ΪÆäÄÚ½¨µÄËÑË÷¹¤¾ß )
ÐÅÏ¢»ñÈ¡ ÓëËÑË÷ÒýÇæ ÐÅÏ¢»ñÈ¡£º °üº¬ÐÅÏ¢µÄ±íʾ¡¢´æ´¢¡¢×éÖ¯ºÍ¶ÔÐÅÏ¢µÄ·ÃÎÊ·½·¨¡£ Êý¾Ý Ë÷Òý ¼ìË÷ ÅÅÐò a.   ¹¹ÔìÎı¾Êý¾Ý¿â £¬´æ·Å½«À´ÐèÒª¼ìË÷µÄÊý¾Ý b.   ½¨Á¢ÎĵµµÄË÷Òý £¬ÓÃÀ´Ìá¸ßÐÅÏ¢¼ìË÷Ëٶȡ£È磬µ¹ÅÅË÷Òý¼¼Êõ c. ÀûÓÃÎı¾´¦Àí¼¼Êõ ·ÖÎöÓû§µÄ²éѯ ¡£ÔÚ½øÐвéѯ֮ǰ»¹¿ÉÒÔ½øÐÐһЩÓë´¦Àí¡£ d.   ¶Ô¼ìË÷½á¹û½øÐд¦Àí £¨ÅÅÐò£© DB/File ¿Í»§ÊäÈë²éѯÌõ¼þ ·´À¡¿Í»§²éѯ½á¹û ÐÅÏ¢
ÐÅÏ¢»ñÈ¡Óë ËÑË÷ÒýÇæ ËÑË÷ÒýÇ棺 È«ÎÄËÑË÷ÒýÇæ £¨ FullText Search Engine £©   £ºÍ¨¹ýÒ»¸ö½ÐÍøÂç»úÆ÷ÈË»ò½ÐÍøÂçÖ©ÖëµÄÈí¼þ£¬×Ô¶¯·ÖÎöÍøÂçÉϵĸ÷ÖÖÁ´½Ó²¢»ñÈ¡ÍøÒ³ÐÅÏ¢ÄÚÈÝ£¬°´¹æÔò¼ÓÒÔ·ÖÎöÕûÀí£¬¼ÇÈëÊý¾Ý¿â¡£µäÐ͵ÄϵͳÓУº Google ºÍ°Ù¶È ·ÖÀàĿ¼ £¨ Directory £©   £ºÔòÊÇ Í¨¹ýÈ˹¤µÄ·½Ê½ÊÕ¼¯ÕûÀíÍøÕ¾×ÊÁÏÐγɵÄÊý¾Ý¿â £¬ÈçÑÅ»¢Öйú¡¢ËѺü¡¢ÐÂÀË¡¢ÍøÒ×µÈÍøÕ¾µÄ·ÖÀàĿ¼¡£ µÚÒ»´úËÑË÷ÒýÇ棺ÒÀ¿¿È˹¤·Ö¼ðµÄ·ÖÀàĿ¼ËÑË÷£¬ e.g. yahoo µÚ¶þ´úËÑË÷ÒýÇ棺ÒÀ¿¿»úÆ÷ץȡ£¬²¢½¨Á¢ÔÚ³¬¼¶Á´½Ó·ÖÎö¼¼Êõ»ù´¡Ö®ÉϵÄÍøÒ³ËÑË÷£¬ e.g. Google Ìص㣺ÐÅÏ¢Á¿´ó£¬¸üм°Ê±£¬µ«·µ»ØÎÞ¹ØÐÅÏ¢¹ý¶à µÚÈý´úËÑË÷ÒýÇ棺ÈÚÈë¡°ÖÇÄÜ»¯¡±£¬¡°ÈË»ú½»»¥¡±¹¦ÄÜ¡£½«×Ô¶¯·ÖÀ༼Êõ£¬ÖÐÎÄÄÚÈÝ·ÖÎö¼¼Êõ¼°ÇøÓòʶ±ð¼¼ÊõÓ¦Óõ½´óÐÍËÑË÷ÒýÇæÖÐ ¡£ ÐÅÏ¢¸üÐÂËٶȿ죬ƵÂÊ¸ß ÍøÒ³Ïà¹Ø¼ìË÷£¬Æ´Òô¾À´í£¬Ä£ºý²éѯ£¬ÓïÒô²éѯ¼¼ÊõÓкܸßË®×¼¡£ ´ËÍ⣬»¹Í¬Ê±¼æ±¸ÁËÐÂÎÅ£¬ MP3 £¬Í¼Æ¬£¬ Flash ËÑË÷¹¦ÄÜ¡£
È«ÎļìË÷ È«ÎļìË÷£º¼ÆËã»úË÷Òý³ÌÐòͨ¹ýɨÃèÎÄÕÂÖеÄÿһ¸ö´Ê£¬¶Ôÿһ¸ö´Ê½¨Á¢Ò»¸öË÷Òý£¬Ö¸Ã÷¸Ã´ÊÔÚÎÄÕÂÖгöÏֵĴÎÊýºÍλÖ㬵±Óû§²éѯʱ£¬¼ìË÷³ÌÐò¸ù¾ÝÊÂÏȽ¨Á¢µÄË÷Òý½øÐвéÕÒ£¬²¢½«²éѯ½á¹û·´À¡¡£ °´×Ö¼ìË÷ £¬¶ÔÓ¢ÎÄ£¬×ÖÓë´ÊºÏÒ»£¬ÖÐÎÄÓкܴóÇø±ð£» °´´Ê¼ìË÷ £¬¶ÔÓïÒ嵥뽨Á¢Ë÷Òý£¬¼ìË÷ʱ°´´Ê¼ìË÷£¬²¢¿ÉÒÔ´¦ÀíͬÒåÏî¡£   ÖÐÎÄÎÄ×ÖµÄÇзÖ×Ö´ÊÊÇÈ«ÎļìË÷µÄ¼¼ÊõÄѵ㡣
È«ÎļìË÷ϵͳ È«ÎļìË÷ϵͳ£º¾ßÓÐ ½¨Á¢Ë÷Òý ¡¢ ´¦Àí²éѯ·µ»Ø½á¹û¼¯ ¡¢ Ôö¼ÓË÷Òý ¡¢ ÓÅ»¯Ë÷Òý½á¹¹ µÈ¹¦ÄÜ£¬ÍâΧÔòÓɸ÷ÖÖ²»Í¬Ó¦ÓþßÓеŦÄÜ×é³É¡£ ²éѯÒýÇæ Îı¾´¦ÀíÒýÇæ Ë÷ÒýÒýÇæ ¶þ´Î¿ª·¢Ó¦ÓÃ½Ó¿Ú Ó¦ÓóÌÐò Web ³ÌÐò ÆäËû ´ÅÅÌË÷ÒýÎļþ
È«ÎļìË÷ ¡Ù  like &quot;%keyword%&quot;   ÓÉÓÚÊý¾Ý¿âË÷Òý²»ÊÇΪȫÎÄË÷ÒýÉè¼ÆµÄ£¬ µ±Ê¹Óà like ¡°%word%¡± ʱ£¬Êý¾Ý¿âË÷ÒýÊDz»Æð×÷ÓÃµÄ £¬ËùÒÔ¶ÔÓÚº¬ÓÐÄ£ºý²éѯµÄÊý¾Ý¿â·þÎñÀ´Ëµ£¬ LIKE ¶ÔÐÔÄܵÄΣº¦ÊǼ«´óµÄ¡£Èç¹ûÊÇÐèÒª¶Ô¶à¸ö¹Ø¼ü´Ê½øÐÐÄ£ºýÆ¥Å䣺 like ¡°%word1%¡° and like ¡±%word2%¡± ÆäЧÂÊÒ²¾Í¿ÉÏë¶øÁË¡£ ½¨Á¢Ò»¸ö¸ßЧ¼ìË÷ϵͳµÄ ¹Ø¼üÊǽ¨Á¢Ò»¸ö·´ÏòË÷Òý»úÖÆ £¬½«Êý¾ÝÔ´£¨±ÈÈç¶àƪÎÄÕ£©ÅÅÐò˳Ðò´æ´¢µÄͬʱ£¬ÓÐÁíÍâÒ»¸öÅźÃÐòµÄ¹Ø¼ü´ÊÁÐ±í£¬ÓÃÓÚ´æ´¢¹Ø¼ü´Ê => ÎÄÕÂÓ³Éä¹Øϵ£¬ ÀûÓÃÕâÑùµÄÓ³Éä¹ØϵË÷Òý£º [ ¹Ø¼ü´Ê => ³öÏֹؼü´ÊµÄÎÄÕ±àºÅ£¬³öÏÖ´ÎÊý£¬³öÏÖƵÂÊ ]  £¬¼ìË÷¹ý³Ì£º °ÑÄ£ºý²éѯ±ä³É¶à¸ö¿ÉÒÔÀûÓÃË÷ÒýµÄ¾«È·²éѯµÄ Âß¼­×éºÏ µÄ¹ý³Ì ¡£
Lucene Lucene ÊÇÒ»¸ö¿ª·ÅÔ´´úÂëµÄÈ«ÎļìË÷ÒýÇ湤¾ß°ü£¬ÊÇ Apache Èí¼þ»ù½ð»á Jakarta ÏîÄ¿µÄ×ÓÏîÄ¿¡£ Lucene ²»ÊÇÒ»¸öÍêÕûµÄÈ«ÎļìË÷ÒýÇ棬¶øÊÇÒ»¸öÈ«ÎļìË÷ÒýÇæµÄ¼Ü¹¹£¬ÌṩÍêÕûµÄ²éѯÒýÇæºÍË÷ÒýÒýÇæ¼°²¿·ÖÎı¾·ÖÎöÒýÇ棨×î³õ£ºÓ¢ÎÄ¡¢µÂÎÄ£©¡£ ²»Í¬³ÌÐòÓïÑÔ°æ±¾ (.Net £¬ C £¬ for script language: ruby, python)
Lucene È«ÎļìË÷ʵÏÖ»úÖÆ Lucene µÄ API ½Ó¿ÚÉè¼ÆµÄ±È½ÏͨÓã¬ÊäÈëÊä³ö½á¹¹¶¼ºÜÏñÊý¾Ý¿âµÄ ±í ==> ¼Ç¼ ==> ×ֶΠ£¬ËùÒԺܶഫͳµÄÓ¦ÓõÄÎļþ¡¢Êý¾Ý¿âµÈ¶¼¿ÉÒԱȽϷ½±ãµÄÓ³Éäµ½ Lucene µÄ´æ´¢½á¹¹ / ½Ó¿ÚÖС£×ÜÌåÉÏ¿´£º¿ÉÒÔÏÈ°Ñ Lucene µ±³ÉÒ»¸öÖ§³ÖÈ«ÎÄË÷ÒýµÄÊý¾Ý¿âϵͳ ¡£ RecordSet £º²éѯ½á¹û¼¯£¬Óɶà¸ö Record ×é³É Hits £º²éѯ½á¹û¼¯£¬ÓÉÆ¥ÅäµÄ Document ×é³É 2.3 -> TopDocCollector collector = new TopDocCollector(10); Field £º×ֶΠField £º×ֶΠRecord £º¼Ç¼£¬°üº¬¶à¸ö×ֶΠDocument £ºÒ»¸öÐèÒª½øÐÐË÷ÒýµÄ¡°µ¥Ôª¡± Ò»¸ö Document Óɶà¸ö×Ö¶Î×é³É Ë÷ÒýÊý¾ÝÔ´£º record(field1,field2...) record(field1..)    SQL: insert/   _____________   | DB  Index  |   -------------   / SQL: select ½á¹ûÊä³ö£º results(record(field1,field2..) record(field1...)) Ë÷ÒýÊý¾ÝÔ´£º doc(field1,field2...) doc(field1,field2...)    indexer /   _____________   | Lucene Index|   --------------   / searcher   ½á¹ûÊä³ö£º Hits(doc(field1,field2) doc(field1...)) Database Lucene
È«ÎļìË÷ ºÍ Êý¾Ý¿âÓ¦Óà ×î´óµÄ ²»Í¬ ÔÚÓÚ£º ÈÃ×îÏà¹ØµÄÍ· 100 Ìõ½á¹ûÂú×ã 98% ÒÔÉÏÓû§µÄÐèÇó ¡£ ûÓнӿڻò½Ó¿Ú¸´ÔÓ£¬ÎÞ·¨¶¨ÖÆ ¡£ ͨ¹ý²»Í¬µÄÓïÑÔ·ÖÎö½Ó¿ÚʵÏÖ£¬¿ÉÒÔ·½±ãµÄ¶¨ÖƳö·ûºÏÓ¦ÓÃÐèÒªµÄË÷Òý¹æÔò£¨°üÀ¨¶ÔÖÐÎĵÄÖ§³Ö£© ¿É¶¨ÖÆÐÔ  ʹÓÃÂʵͣ¬Ä£ºýÆ¥Åä¹æÔò¼òµ¥»òÕßÐèҪģºý²éѯµÄ×ÊÁÏÁ¿ÉÙ ¸ß¸ºÔصÄÄ£ºý²éѯӦÓã¬ÐèÒª¸´ÔÓµÄÄ£ºý²éѯ¹æÔò£¬Ë÷ÒýµÄ×ÊÁÏÁ¿±È½Ï´ó ½áÂÛ ·µ»ØËùÓеĽá¹û¼¯£¬ÔÚÆ¥ÅäÌõÄ¿·Ç³£¶àµÄʱºòÐèÒª´óÁ¿µÄÄÚ´æ´æ·ÅÕâЩÁÙʱ½á¹û¼¯¡£  ͨ¹ýÌرðµÄËã·¨£¬½«×îÆ¥Åä¶È×î¸ßµÄÍ· 100 Ìõ½á¹ûÊä³ö£¬½á¹û¼¯ÊÇ»º³åʽµÄСÅúÁ¿¶ÁÈ¡µÄ¡£  ½á¹ûÊä³ö  ûÓÐÆ¥Åä³Ì¶ÈµÄ¿ØÖÆ£º±ÈÈçÓмǼÖÐ net ³öÏÖ 5 ´ÊºÍ³öÏÖ 1 ´ÎµÄ£¬½á¹ûÊÇÒ»ÑùµÄ¡£  ÓÐÆ¥Åä¶ÈËã·¨£¬½«Æ¥Åä³Ì¶È£¨ÏàËƶȣ©±È½Ï¸ßµÄ½á¹ûÅÅÔÚÇ°Ãæ¡£  Æ¥Åä¶È  ʹÓ㺠like ¡°%net%¡±  »á°Ñ netherlands ҲƥÅä³öÀ´£»Ê¹Óà like &quot;%com%net%&quot; £º¾Í²»ÄÜÆ¥Åä´ÊÐòµßµ¹µÄ xxx.net..xxx.com  ͨ¹ý´ÊÔª (term) ½øÐÐÆ¥Å䣬ͨ¹ýÓïÑÔ·ÖÎö½Ó¿ÚµÄʵÏÖ£¬¿ÉÒÔʵÏÖ¶ÔÖÐÎĵȷÇÓ¢ÓïµÄÖ§³Ö¡£ Æ¥ÅäЧ¹û ¶ÔÓÚ LIKE ²éѯÀ´Ëµ£¬Êý¾Ý´«Í³µÄË÷ÒýÊǸù±¾Óò»Éϵġ£  ½«Êý¾ÝÔ´ÖеÄÊý¾Ý¶¼Í¨¹ýÈ«ÎÄË÷ÒýÒ»Ò»½¨Á¢·´ÏòË÷Òý  Ë÷Òý Êý¾Ý¿â   Lucene È«ÎÄË÷Òý
Lucene µÄ´´ÐÂÖ®´¦ ´ó²¿·ÖµÄËÑË÷£¨Êý¾Ý¿â£©ÒýÇ涼ÊÇÓà B Ê÷½á¹¹À´Î¬»¤Ë÷Òý£¬Ë÷ÒýµÄ¸üлᵼÖ´óÁ¿µÄ IO ²Ù×÷¡£ Lucene ¶Ô´ËÉÔ΢ÓÐËù¸Ä½ø£º ²»ÊÇά»¤Ò»¸öË÷ÒýÎļþ£¬¶øÊÇÔÚÀ©Õ¹Ë÷ÒýµÄʱºò²»¶Ï´´½¨ÐµÄË÷ÒýÎļþ£¬È»ºó¶¨ÆڵİÑÕâЩеÄСË÷ÒýÎļþºÏ²¢µ½Ô­ÏȵĴóË÷ÒýÖÐ £¨Õë¶Ô²»Í¬µÄ¸üвßÂÔ£¬Åú´ÎµÄ´óС¿ÉÒÔµ÷Õû£©£¬ÕâÑùÔÚ²»Ó°Ïì¼ìË÷µÄЧÂʵÄÇ°ÌáÏ£¬Ìá¸ßÁËË÷ÒýµÄЧÂÊ¡£ Lucene ²¢Ã»Óй涨Êý¾ÝÔ´µÄ¸ñʽ£¬¶øÖ»ÌṩÁËÒ»¸öͨÓõĽṹ£¨ Document ¶ÔÏó£©À´½ÓÊÜË÷ÒýµÄÊäÈ룬Òò´ËÊäÈëµÄÊý¾ÝÔ´¿ÉÒÔÊÇ£ºÊý¾Ý¿â£¬ WORD Îĵµ£¬ PDF Îĵµ£¬ HTML Îĵµ¡­¡­Ö»ÒªÄܹ»Éè¼ÆÏàÓ¦µÄ½âÎöת»»Æ÷½«Êý¾ÝÔ´¹¹Ôì³É Docuement ¶ÔÏ󼴿ɽøÐÐË÷Òý¡£
Ë÷Òý Óë ËÑË÷ Ë÷Òý   --  ÌØÊâµÄÊý¾Ý½á¹¹£¬Ìá¸ßËÑË÷ЧÂÊ£¬²»Ö§³Ö¿ìËÙÐÅÏ¢¸üУ¬¶¨ÆÚ¸üÐÂË÷Òý¡£ Ë÷Òý¼¼Êõ£ºµ¹ÅÅË÷Òý£¨¶ÔÓڹؼü´ÊµÄËÑË÷·Ç³£ÓÐЧ£¬ Lucene £©£¬ ºó׺Êý×飨¶ÌÓï²éѯËٶȿ죬Êý¾Ý½á¹¹¹¹Ôìά»¤¸´ÔÓ£©£¬ Ç©ÃûÎļþ£¨Á÷ÐÐÓÚ 20 ÊÀ¼Í 80 Äê´ú£¬±»µ¹ÅÅË÷Òý³¬Ô½£© ËÑË÷  ¨C ΪÓû§Ìṩ¸ßÖÊÁ¿£¨ÏìӦʱ¼ä¡¢×¼È·¶È£©µÄËÑË÷½á¹û¡£¸ßЧµÄËÑË÷Ëã·¨¼°¶ÔËÑË÷½á¹û·á¸»µÄÅÅÐò·½·¨
µ¹ÅÅË÷Òý Îĵµ A £º This is a dog B £º This dog is a kind of animal ÈçÓÒͼ ͨ¹ý±È½Ï£º Ò»°ãµÄË÷Òý½á¹¹½¨Á¢µÄÊÇÒ»ÖÖ¡°Îĵµµ½µ¥´Ê¡±µÄÓ³Éä¹Øϵ£¬ ¶øµ¹ÅÅË÷Òý½¨Á¢µÄÔòÊÇÒ»ÖÖ¡°µ¥´Êµ½Îĵµ¡±µÄÓ³Éä¹Øϵ¡£ Óû§ÔÚ½øÐмìË÷ʱ£¬¶¼ÊÇÊäÈë¹Ø¼ü×Ö½øÐвéѯ£¬Èç¹ûʹÓÃÒ»°ãµÄË÷Òý½á¹¹£¬ÔÚ²éѯijһ¹Ø¼ü×ÖʱÐèÒª±éÀúËùÓÐË÷Òý£¬Ë÷ÒýÁ¿´óʱ£¬Ð§Âʲ 1 B kind 1 kind B 1 dog B 1 B animal 1,1 A,B dog ³öÏÖ´ÎÊý ³öÏÖµÄÎĵµ µ¥´Ê µ¹ÅÅË÷Òý½á¹¹ 1 animal B 1 dog A ³öÏÖ´ÎÊý ³öÏÖµ¥´Ê Îĵµ±àºÅ Ò»°ãË÷Òý½á¹¹
Lucene ʹÓà Lucene À´Îª±¾µØÎļþ½¨Á¢Ë÷Òý
½¨Á¢Ë÷Òý
Lucene ½¨Á¢Ë÷Òý¹ý³Ì 1).  ÌáÈ¡Îı¾£º ´Ó¸÷ÖÖÎĵµÖÐÌáÈ¡Îı¾ÐÅÏ¢ 2).  ¹¹½¨ Document ½«ÌáÈ¡³öµÄÎı¾×é×°³É Lucene ¿ÉÒÔʶ±ðµÄ¸ñʽÀ´ÎªË÷Òý½¨Á¢×ö×¼±¸ 3).  ·ÖÎö ¶ÔÒª½¨Á¢Ë÷ÒýµÄÊý¾Ý½øÐзÖÎö£¬Ê¹½¨Á¢Ë÷Òýʱ¸üÈÝÒ×´¦ÀíÊý¾Ý 4).  ½¨Á¢Ë÷Òý µ÷Óà IndexWriter ÀàµÄ addDocument() ·½·¨½¨Á¢Ë÷Òý¡£
Lucene -- Document Lucene µÄ Document ´ú±íÁËÒ»¸öÐèÒª½øÐÐ Ë÷ÒýµÄ¡°µ¥Ôª¡±£¬ ÈκÎÐèÒª½øÐÐË÷ÒýµÄÊý¾ÝÔ´£¨È磺Îļþ£© ¶¼±ØÐ뱻ת»¯³É Document ¶ÔÏó ²ÅÄܹ»±»Ë÷ÒýºÍËÑË÷µ½¡£
Lucene -- IndexWriter ¹¦ÄÜ£º½«Îĵµ¼ÓÈëË÷Òý£¬Í¬Ê±¿ØÖÆË÷Òý¹ý³ÌÖеĸ÷ÖÖ²ÎÊý¡£ ³õʼ»¯£º ²ÎÊý£º Ë÷Òý´æ·ÅµÄ·¾¶£º String, java.io.File, Directory IndexWriter writer1 = new IndexWriter(¡°c:index1¡±, new StandardAnalyzer(), true); File f = new File(¡°c:index2¡±); IndexWriter writer2 = new IndexWriter(f, new StandardAnalyzer(), true); Directory d = new RAMDirectory(); IndexWriter writer3 = new IndexWriter(d, new StandardAnalyzer(), true); ·ÖÎöÆ÷£ºÔÚ IndexWriter ½«ÎĵµÐ´ÈëË÷ÒýÇ°£¬°ÑÎı¾ÐÅÏ¢ÇзֳÉÒ»¸ö¸ö¿ÉÒÔ½øÐÐË÷ÒýµÄ´ÊÌõ¡£¼Ì³Ð×Ô org.apache.lucene.analysis.Analyzer ÀàµÄ·ÖÎöÆ÷ ÖØд´½¨Ë÷Òý true/ ÔöÁ¿Ë÷Òý false
Lucene -- IndexWriter ÏòË÷ÒýÌí¼ÓÎĵµ µ÷ÕûÐÔÄܲÎÊý 1. mergeFactor £ºÄ¬ÈÏֵΪ 10 £¬ÓÃÀ´¿ØÖÆ lucene ÔÚ°ÑË÷Òý´ÓÄÚ´æдÈë´ÅÅÌÉϵÄÎļþϵͳʱÄÚ´æÖÐ×î´óµÄ Document ÊýÁ¿¼°×î´ó Segment ÊýÁ¿¡£Ó°Ï콨Á¢Ë÷ÒýʱËù»¨·ÑµÄ´ÅÅÌ I/O ʱ¼äºÍÄÚ´æ¡£ÉèÖÃ̫С£¬ I/O ²Ù×÷Ƶ·±£¬¾­³£½øÐÐ segment ºÏ²¢£¬ÉèÖÃÌ«´ó£¬ÄÚ´æÖгÖÓÐµÄ Document ÊýÁ¿¶à£¬½¨Á¢Ë÷Òý¿ì£¬µ«´óÁ¿Õ¼ÓÃÄÚ´æ¡£ public   void  setMergeFactor( int  mergeFactor) { getLogMergePolicy().setMergeFactor(mergeFactor); } 2. maxMergeDocs £ºÏÞÖÆÒ»¸ö segment ÖÐ×î´óµÄÎĵµÊýÁ¿¡£ public   void  setMaxMergeDocs( int  maxMergeDocs) { getLogMergePolicy().setMaxMergeDocs(maxMergeDocs); } ÏÞÖÆ Field ³¤¶È£º maxFieldLength £¬Ä¬ÈÏֵΪ 10000 £¬Ö»¶ÔÇ° 10000 ¸ö term Ë÷Òý¡£
Lucene µÄË÷ÒýÎļþ¸ñʽ ¹æ¶¨ÁË Lucene µÄÎļþ¸ñʽ²ÉÈ¡µÄ´æ´¢µ¥Î»¡¢×éÖ¯½á¹¹¡¢ÃüÃû¹æ·¶µÈµÈÄÚÈÝ Ë÷ÒýÎļþ¸ñʽ£º¶àÎļþË÷ÒýÎļþ¸ñʽ¡¢¸´ºÏË÷Òý¸ñʽ setUseCompoundFile( boolean  isCompoundFile)
Lucene Îļþ¸ñʽÖж¨ÒåµÄÊý¾ÝÀàÐÍ ÔÚ Lucene µÄÎļþ¸ñʽÖУ¬ÒÔ×Ö½ÚΪ»ù´¡£¬²¢ÇÒ¶¨ÒåÁË×ÔÉíµÄÊý¾ÝÀàÐÍ . ÓÉÓÚËüÃǶ¼ÒÔ×Ö½ÚΪ»ù´¡¶¨Òå¶øÀ´£¬Òò´Ë±£Ö¤ÁËÊÇƽ̨Î޹أ¬ÕâÒ²ÊÇ Lucene Ë÷ÒýÎļþ¸ñʽƽ̨Î޹صÄÖ÷ÒªÔ­Òò .
Lucene Ë÷ÒýÎļþ¸ÅÄî½á¹¹ Segment £ºÒ»¸ö¶ÎÊÇÒ»¸ö¶ÀÁ¢µÄË÷Òý£¬¿ÉÒÔÓÉ IndexSearcher ½øÐе¥¶À²éÕÒ¡£ Lucene µÄ¹¤×÷Æäʵ¾ÍÊDz»Í£µØÍù´ÅÅ̼ÓÈëÐ嵀 Segment £¬²¢°´Ò»¶¨µÄËã·¨ºÏ²¢²»Í¬µÄ Segment ÒÔ´´½¨Ò»¸öеĶΡ£ Ï Term £©ÊÇ×îСµÄË÷Òý¸ÅÄ룬ËüÖ±½Ó´ú±íÁËÒ»¸ö×Ö·û´®ÒÔ¼°ÆäÔÚÎļþÖеÄλÖᢳöÏÖ´ÎÊýµÈÐÅÏ¢¡£ Óò£¨ Field £©ÊÇÒ»¸ö¹ØÁªµÄÔª×飬ÓÉÒ»¸öÓòÃûºÍÒ»¸öÓòÖµ×é³É£¬ÓòÃûÊÇÒ»¸ö×Ö´®£¬ÓòÖµÊÇÒ»¸öÏî
Lucene Ë÷ÒýÎļþ½á¹¹×é³É Óò¼¯ºÏÓëÏºÏÖеÄÎļþ×é²ÉÓÃÁËÒ»ÖÖÀàËƵĴ洢°ì·¨£ºÒ»¸öСÐ͵ÄË÷ÒýÎļþ£¬ÔËÐÐʱÔØÈëÄڴ棻һ¸ö¶ÔÓ¦ÓÚË÷ÒýÎļþµÄʵ¼ÊÐÅÏ¢Îļþ£¬¿ÉÒÔ°´ÕÕË÷ÒýÖÐָʾµÄÆ«ÒÆÁ¿Ëæ»ú·ÃÎÊ£» Ë÷ÒýÎļþÓëÐÅÏ¢ÎļþÔڼǼµÄÅÅÁÐ˳ÐòÉÏ´æÔÚÒþʽµÄ¶ÔÓ¦¹Øϵ£¬¼´Ë÷ÒýÎļþÖа´ÕÕ¡°Ë÷ÒýÏî 1 ¡¢Ë÷ÒýÏî 2¡­¡± ÅÅÁУ¬ÔòÐÅÏ¢ÎļþÔòÒ²°´ÕÕ¡°ÐÅÏ¢Ïî 1 ¡¢ÐÅÏ¢Ïî 2¡­¡± ÅÅÁС£
Ò»¹²ÓÐËĸöÎļþ£¨ .tii,?.tis,.frq,.prx £©ÓÃÀ´¼Ç¼ Term Ïà¹ØµÄÐÅÏ¢£º --  ÔÚ .tis ÎļþÖУ¬¶Ôÿ¸ö Term ¶¼ÓÐÒ»Ïî TermInfo, ¶øÇÒ TermInfo ÊǸù¾Ý×Öµä˳ÐòÅÅÐò¡£ TermInfo ÖмǼµÄÁË Term ±¾Éí£¬ÒÔ¼°Ò»Ð©ÒÔÔÚ .frq ºÍ .prx Öк͸à Term Ïà¹ØÏêϸµÄÖ¸Õë¡£ -- .tii ÊÇ¶Ô .tis µÄÒ»¸öË÷Òý£¬ÓÃÀ´¼ÓËÙ¶Ô Term µÄ²éÕÒ¡£ -- .frq Îļþ¼Ç¼ÁËÿ¸ö Term ³öÏÖµÄÎĵµºÅÒÔ¼°ÆäƵÂÊ£¬ -- .prx Îļþ¼Ç¼ÁËÿ¸ö Term ÔÚÿƪÎĵµÖгöÏÖµÄλÖÃÐÅÏ¢¡£
Ë÷Òý´æ´¢³éÏó  --  Ë÷Òý´æ·ÅλÖà ´ÅÅÌ  ¨C  FSDirectory  ½«Ë÷Òý´æ·ÅÔÚÎļþϵͳÖУ¬ Lucene »á×Ô¶¯ÔÚÄÚ´æÖн¨Á¢»º´æ£¬È»ºóµ½Ò»¶¨Ê±ºò¾ÍдÈë´ÅÅÌ¡£ IndexWriter writer = new IndexWriter(FSDirectory.getDirectory(path, true), new StandardAnalyzer(), true); ÄÚ´æ  ¨C  RAMDirectory £¬Ëٶȿ죬·Ç³Ö¾Ã»¯£¨ÐéÄâ»úÍ˳ö£¬Ë÷Òý¶ªÊ§£©£¬Òò´ËÐèÒ»·½·¨½«ÄÚ´æÖеÄË÷ÒýתÈë´ÅÅÌ¡£ IndexWriter writer = new IndexWriter(RAMDirectory.getDirectory(), new StandardAnalyzer(), true);
Ë÷ÒýºÏ²¢ Ë÷ÒýµÄ ºÏ²¢ £ºµ±¿ª·¢ÕßÔÚ²»Í¬µÄµØ·½´´½¨Ðí¶àË÷Òý£¬Ä³ÖÖÇé¿öÏ£¬Ðè½øÐкϲ¢¡£ public   void  addIndexes(Directory[]  dirs ) £¬ ¿ÉÒԺϲ¢ FSDirecotry ºÍ RAMDirectory £¬Ò²¿ÉÒԺϲ¢Á½¸ö FSDirectory ramWriter.addDocument(doc1); fsWriter.addDocument(doc2); ramWriter.close();// Ë÷Òý´´½¨Íê±Ï£¬¹Ø±ÕÄÚ´æËùÒýÆ÷£¬Ê¹ËùÓÐÎĵµ½øÈëÄÚ´æË÷ÒýÎļþ fsWriter.addIndexes(new Directory[]{fsDir}); fsWriter.close(); ɾ³ýÎĵµ¸ñʽ£ºÉ¾³ýÌض¨Îĵµ¡¢°´ Field À´É¾³ý IndexReader deleteDocuments(int docNum) ,  undeleteAll() deleteDocuments(Term term)
Lucene Ë÷ÒýÓÅ»¯¡¢Í¬²½»úÖÆ optimize() £ºÍ¨¹ýÓÅ»¯¿ÉÒÔ¼õÉÙÒ»¸öËÑË÷Æ÷Ҫͬʱ´ò¿ªµÄÎļþÊý£¬½µµÍ I/O ¡£ ½«´ÅÅÌÉ϶à¸ö Segment ½øÐкϲ¢£¬×é³ÉÒ»¸öÈ«Ð嵀 Segment £¬¶Ô´ÅÅÌ¿Õ¼äÐèÇó´ó£¬Ó¦ÔÚ´óÅúÁ¿Ë÷Òý½¨Á¢Íê³ÉºóÔÙ½øÐе÷Óã¬×¢ÒâË÷ÒýÓÅ»¯ÖÜÆÚ¡£ ¶àÏ̻߳·¾³ÏµÄͬ²½»úÖÆ£¨Í¬²½·¨Ôò£©£º ÈκÎÊýÁ¿µÄÖ»¶Á²Ù×÷¿ÉÒÔ±»Í¬Ê±Ö´ÐУ¬ÈçʹÓà IndexSearcher ½øÐмìË÷ ÈκÎÊýÁ¿µÄÖ»¶Á²Ù×÷¶¼¿ÉÒÔÔÚË÷ÒýÕýÔÚ±»ÐÞ¸ÄʱִÐУ¬È磬ÍùË÷ÒýÖÐмÓÎĵµ¡¢É¾³ý¾ÉÎĵµ»òË÷ÒýÓÅ»¯¹ý³Ì ͬһʱ¼äÄÚ£¬Ö»¿ÉÒÔÓÐÒ»¸öÐÞ¸ÄË÷Òý²Ù×÷¡£ IndexWriter/IndexReader Lucene µÄË÷Òý¡°Ëø¡±£º Lucene ÉèÖÃÁË ÎļþËø £¬Ä¬ÈÏ·ÅÖÃÔÚϵͳÁÙʱÎļþ¼ÐÏ£¬¸ÃÎļþ¼Ð·¾­ÓÉ java.io.tempdir ϵͳ±äÁ¿Ö¸¶¨¡£ writer.lock £º·ÀÖ¹¶àÏß³ÌͬʱÐÞ¸ÄÒ»Ë÷ÒýÎļþ£¬ÓÉ IndexWriter ³õʼ»¯Ê±»ñµÃ£¬ÔڹرÕʱÊÍ·Å¡£ commit.lock £ºÔÚË÷ÒýµÄ Segment ±»½¨Á¢¡¢ºÏ²¢»ò¶ÁȡʱÉú³É¡£
Lucene ËÑË÷ ËÑË÷µÄÁ÷³Ì ³õʼ»¯ IndexSearcher £º  Searcher searcher = new IndexSearcher(indexDir); ¹¹½¨ Query £º Èç²éѯ·½Ê½£¨Ä£ºý²éѯ¡¢ÓïÒå²éѯ¡¢¶ÌÓï²éѯ¡¢·¶Î§²éѯ¡¢ ×éºÏ²éѯµÈ£©  Query query = QueryParser.parse(queryString) ËÑË÷²¢´¦Àí·µ»Ø½á¹û £º Hits hits = searcher.search(query);  ÅÅÐò¡¢¹ýÂË Web ¿ª·¢Ê±£¬½« Lucene ÓëÊý¾Ý¿âÏà½áºÏ£¬ÔÚË÷ÒýÖдæÈëһЩ¹Ø¼üµÄ ID ×ֶΡ¢Â·¾¶×ֶλòÊǼòµ¥µÄÎı¾£¬ÕæÕýµÄÊý¾ÝÌáÈ¡Ôò´ÓÊý¾Ý¿âÖеõ½¡£
¼ìË÷½á¹û  -- Hits Lazy load result, LRU doubly-linked cache
Lucene µÄÆÀ·Ö»úÖÆ ÆÀ·Ö»úÖƾÍÊǶԼìË÷½á¹û°´Ä³ÖÖ±ê×¼½øÐÐÆÀ¹À£¬È»ºó°´·ÖÖµµÄ¸ßµÍÀ´¶Ô½á¹û½øÐÐÅÅÐò¡£ ¶ÔÓÚÒ»¸öÉÌÓõÄËÑË÷ÒýÇæÀ´Ëµ£¬ÆÀ·Ö»úÖÆÊÇÆäÊÕÈëÀ´Ô´µÄÒ»²¿·Ö¡£ Lucene ÆÀ·ÖËã·¨£º£¨¼òµ¥Àí½â³Éij¸ö¹Ø¼ü×ÖÔÚÎĵµÖгöÏÖµÄƵÂÊ£© ¿ÉÒÔͨ¹ý Document µÄ setBoost(float boost) À´¸Ä±äÎĵµ boost Òò×Ó£¬½ø¶ø¸Ä±äÎĵµÆÀ·Ö
¹¹½¨ Query °´´ÊÌõËÑË÷ ¨C  TermQuery Term term = new Term(¡°contents¡±, ¡°java¡±); Query query = new TermQuery(term); BooleanQuery public void add(BooleanClause clause) RangeQuery public RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive) PrefixQuery public PrefixQuery(Term prefix) ¶à¹Ø¼ü×ÖËÑË÷  --  PhraseQuery public void add(Term term) public void setSlop(int s)  // Sets the number of other words permitted between words in  //query phrase.  If zero, then this is an exact phrase search. Ïà½ü´ÊÓïµÄËÑË÷ ¨C  FuzzyQuery ͨÅä·ûËÑË÷ ¨C   WildcardQuery   // *, ? ¡­¡­ ½âÎöÓû§ÊäÈë×Ö·û´®  --  QueryParser
Lucene ·ÖÎöÆ÷ ¹ÜµÀ¹ýÂËÆ÷ģʽ £º·ÖÎöÆ÷ (Analyzer) ʹÓ÷ִÊÆ÷ (Tokenizer) ºÍ¹ýÂËÆ÷ (TokenFilter) ¹¹³ÉÒ»¸ö¹ÜµÀ£¬Îı¾ÔÚ¡°Á÷¹ý¡±Õâ¸ö¹ÜµÀºó£¬¾Í³ÉΪ¿ÉÒÔ½øÈëË÷ÒýµÄ×îСµ¥Ôª¡£ JavaCC Óë StandardAnalyzer(JavaCC Ϊ Lucene ¹¹½¨µÄ·ÖÎöÆ÷ ) TokenStream Tokenizer TokenFilter
Lucene ÄÚ½¨·ÖÎöÆ÷
¸ß¼¶ËÑË÷¼¼ÇÉ ¶ÔËÑË÷½á¹ûµÄÅÅÐò ¶àÓòËÑË÷ºÍ¶àË÷ÒýËÑË÷ ¶ÔËÑË÷½á¹¹µÄ¹ýÂË
¶ÔËÑË÷½á¹ûµÄÅÅÐò ÀýÈ磺 °Ñ²éѯ½á¹û°´ÕÕÀà±ð½øÐзÖ×é ÔÚ×éÄÚÔÙ°´ÕÕÓë²éѯµÄÏà¹Ø¶È½øÐÐÅÅÐò
ËÑË÷ÒýÇæµÄÖÐÎÄÎÊÌâ ¶ÔÓÚÑÇÖÞÓïÑԵĵÄÇзִÊÎÊÌâ ¶ÔÓÚÖÐÎÄÀ´Ëµ£¬È«ÎÄË÷ÒýÊ×ÏÈ»¹Òª½â¾öÒ»¸öÓïÑÔ·ÖÎöµÄÎÊÌâ¡£Ó¢ÎÄÓï¾äÖе¥´ÊÖ®¼äÊÇÌìȻͨ¹ý¿Õ¸ñ·Ö¿ªµÄ£¬µ«ÑÇÖÞÓïÑÔµÄÖÐÈÕº«ÎÄÓï¾äÖеÄ×ÖÊÇÒ»¸ö×Ö°¤Ò»¸ö£¬ËùÓУ¬Ê×ÏÈÒª°ÑÓï¾äÖа´¡°´Ê¡±½øÐÐË÷ÒýµÄ»°£¬Õâ¸ö´ÊÈçºÎÇзֳöÀ´¾ÍÊÇÒ»¸öºÜ´óµÄÎÊÌâ¡£ Ê×ÏÈ£¬¿Ï¶¨²»ÄÜÓõ¥¸ö×Ö·û×÷ (si-gram) ΪË÷Òýµ¥Ôª£¬·ñÔò²é¡°ÉϺ£¡±Ê±£¬º¬ÓС°º£ÉÏ¡±Ò²ÄÜÆ¥Åä¡£ µ«Ò»¾ä»°£º¡°±±¾©Ìì°²ÃÅ¡±£¬¼ÆËã»úÈçºÎ°´ÕÕÖÐÎĵÄÓïÑÔÏ°¹ß½øÐÐÇзÖÄØ£¿ ¡°±±¾© Ìì°²ÃÅ¡± »¹ÊÇ¡°±± ¾© Ìì°²ÃÅ¡±£¿ÈüÆËã»úÄܹ»°´ÕÕÓïÑÔÏ°¹ß½øÐÐÇз֣¬ÍùÍùÐèÒª»úÆ÷ÓÐÒ»¸ö±È½Ï·á¸»µÄ´Ê¿â²ÅÄܹ»±È½Ï׼ȷµÄʶ±ð³öÓï¾äÖеĵ¥´Ê¡£ ÁíÍâÒ»¸ö½â¾öµÄ°ì·¨ÊDzÉÓÃ×Ô¶¯ÇзÖËã·¨£º½«µ¥´Ê°´ÕÕ 2 ÔªÓï·¨ (bigram) ·½Ê½ÇзֳöÀ´£¬±ÈÈ磺 ¡°±±¾©Ìì°²ÃÅ¡±  ==> ¡° ±±¾© ¾©Ìì Ìì°² °²ÃÅ¡±¡£ ÕâÑù£¬ÔÚ²éѯµÄʱºò£¬ÎÞÂÛÊDzéѯ¡°±±¾©¡± »¹ÊDzéѯ¡°Ìì°²ÃÅ¡±£¬½«²éѯ´Ê×鰴ͬÑùµÄ¹æÔò½øÐÐÇз֣º¡°±±¾©¡±£¬¡°Ìì°²ÃÅ¡±£¬¶à¸ö¹Ø¼ü´ÊÖ®¼ä°´Óë¡° and¡± µÄ¹Øϵ×éºÏ£¬Í¬ÑùÄܹ»ÕýÈ·µØÓ³Éäµ½ÏàÓ¦µÄË÷ÒýÖС£ÕâÖÖ·½Ê½¶ÔÓÚÆäËûÑÇÖÞÓïÑÔ£ºº«ÎÄ£¬ÈÕÎĶ¼ÊÇͨÓõġ£ »ùÓÚ×Ô¶¯ÇзֵÄ×î´óÓŵãÊÇûÓдʱíά»¤³É±¾£¬ÊµÏÖ¼òµ¥£¬È±µãÊÇË÷ÒýЧÂʵ͡£
ÖÐÎÄ·Ö´Ê lucene ×ÔÉíÌṩµÄ StandardAnalyzer ÒѾ­¾ß±¸ÖÐÎķִʵŦÄÜ£¬µ«ÊDz»Ò»¶¨Äܹ»Âú×ã´ó¶àÊýÓ¦ÓõÄÐèÒª¡£ ÁíÍâÎÒÃÇ̸µÄ±È½Ï¶àµÄÖÐÎÄ·Ö´ÊÆ÷»¹ÓУº CJKAnalyzer  ¶þÔª·Ö´Ê ChineseAnalyzer  »ù±¾µÈͬ StandardAnalyzer IK_CAnalyzer £¨ MIK_CAnalyzer £© »¹ÓÐһЩÍøÓÑ×Ô¼ºÐ´µÄ±È½Ï²»´íµÄ·Ö´ÊÆ÷ paoding £¬ÓÐÐËȤµÄ¿ÉÒÔ×Ô¼ºÑо¿Ñо¿¡£ CJKAnalyzer ºÍ ChineseAnalyzer ·Ö±ðÊÇ lucene-2.4.0 Ŀ¼Ï contrib Ŀ¼Ï lucene-analyzers-2.4.0 µÄ analyzers ÌṩµÄ¡£·Ö±ðλÓÚ cn ºÍ cjk Ŀ¼¡£ IK_CAnalyzer £¨ MIK_CAnalyzer £©ÊÇ»ùÓڷִʴʵ䣬Ŀǰ×îÐ嵀 1.4 °æ±¾ÊÇ»ùÓÚ lucene2.0 ¿ª·¢µÄ¡£ ÕýÏòÈ«ÇзִַÊÆ÷£º org.mira.lucene.analysis.IK_CAnalyzer £¨ÊʺϽ¨Ë÷ÒýʱʹÓã©  ÕýÏò×î´óÈ«ÇзִַÊÆ÷£º org.mira.lucene.analysis.MIK_CAnalyzer £¨ÊʺÏÓû§ÊäÈë¼ìË÷ʱʹÓã©
Óà lucene ºÍ Heritrix ¹¹½¨ÁËÒ»¸ö Web  ËÑË÷Ó¦ÓóÌÐò Lucene  ÊÇ»ùÓÚ  Java  µÄÈ«ÎÄÐÅÏ¢¼ìË÷°ü£¬ËüÄ¿Ç°ÊÇ  Apache Jakarta  ¼Ò×åÏÂÃæµÄÒ»¸ö¿ªÔ´ÏîÄ¿¡£ Lucene ºÜÇ¿´ó£¬µ«ÊÇ£¬ÎÞÂÛ¶àôǿ´óµÄËÑË÷ÒýÇ湤¾ß£¬ÔÚÆäºǫ́£¬¶¼ÐèÒªÒ»Ñù¶«Î÷À´Ö§Ô®Ëü£¬ÄǾÍÊÇÍøÂçÅÀ³æ Spider ¡£ÍøÂçÅÀ³æ Spider £¬»ò³ÆÍøÂç»úÆ÷ÈË¡¢ BOT µÈ£¬ÓÉÓÚÅÀ³æµÄ´æÔÚ£¬²ÅʹµÃËÑË÷ÒýÇæÓÐÁ˷ḻµÄ×ÊÔ´¡£ Heritrix ÊÇÒ»¸ö´¿ÓÉ Java ¿ª·¢µÄ¡¢¿ªÔ´µÄ Web ÍøÂçÅÀ³æ£¬Óû§¿ÉÒÔʹÓÃËü´ÓÍøÂçÉÏץȡÏëÒªµÄ×ÊÔ´¡£ËüÀ´×ÔÓÚ www.archive.org ¡£ Heritrix ×î³öÉ«Ö®´¦ÔÚÓÚËüµÄ¿ÉÀ©Õ¹ÐÔ£¬¿ª·¢Õß¿ÉÒÔÀ©Õ¹ËüµÄ¸÷¸ö×é¼þ£¬À´ÊµÏÖ×Ô¼ºµÄץȡÂß¼­¡£
ϵͳ¼Ü¹¹ ÔÚÇ°¶ËÁ÷³ÌÖУ¬Óû§ÔÚËÑË÷ÒýÇæÌṩµÄ½çÃæÖÐÊäÈëÒªËÑË÷µÄ¹Ø¼ü´Ê£¬ÕâÀïÌáµ½µÄÓû§½çÃæÒ»°ãÊÇÒ»¸ö´øÓÐÊäÈë¿òµÄ  Web  Ò³Ã棬ȻºóÓ¦ÓóÌÐò½«ËÑË÷µÄ¹Ø¼ü´Ê½âÎö³ÉËÑË÷ÒýÇæ¿ÉÒÔÀí½âµÄÐÎʽ£¬²¢ÔÚË÷ÒýÎļþÉϽøÐÐËÑË÷²Ù×÷¡£ÔÚÅÅÐòºó£¬ËÑË÷ÒýÇæ·µ»ØËÑË÷½á¹û¸øÓû§¡£ÔÚºó¶ËÁ÷³ÌÖУ¬ÍøÂçÅÀ³æ´ÓÒòÌØÍøÉÏ»ñÈ¡  Web  Ò³Ã棬ȻºóË÷Òý×Óϵͳ½âÎöÕâЩ  Web  Ò³Ãæ²¢´æÈëË÷ÒýÎļþÖС£
DB  È«ÎļìË÷ Mysql Sql server
Hibernate Lucene Integration   http://wiki.redsaga.com/confluence/display/HART/Hibernate+Lucene+Integration Lucene ʹÓÃÕßɳÁú http://blog.cnblog.org/archives/2005/07/luceneaecee.html

More Related Content

Ajax Lucence

  • 2. Ajax & Lucene Ajax Google Suggest ÌáʾÐÅÏ¢ Google Map Ëõ·Å£¬ÍÏק ÍøÒ³ÏìÓ¦Ëٶȸü¿ì£¬¿ÉÒÔÍ϶¯£¬Òì²½´¦Àí Lucene µ±Ç°ÉÌÒµÐÍÏîÄ¿Öж¼ÐèÒªÓÐËÑË÷µÄ¹¦ÄÜ ÓÐЩ¿ÉÒÔͨ¹ý SQL À´ÊµÏÖËÑË÷ ¶ÔÓÚÈ«ÎļìË÷£¨Èç¶ÔÒ»¸ö¹«Ë¾ 5 ÄêÀ´ËùÓб¨±íÊý¾ÝºÍ»áÒé¼Ç¼µÄËÑË÷£©£¬Êý¾Ý¿âµÄËٶȺÍÐÔÄÜÎÞ·¨Âú×ãÐèÇó ¹ºÂò Google µÈ¹«Ë¾µÄËÑË÷·þÎñ ×Ô¼º¿ª·¢ËÑË÷ÒýÇæ ebay ¡­ ʹÓà Apache ¿ªÔ´È«ÎļìË÷¹¤¾ß°ü Lucene ·½±ãµØ¹¹½¨×Ô¼ºµÄËÑË÷ÒýÇæ Eclipse ¾ÍÊÇʹÓà Lucene ×÷ΪÆäÄÚ½¨µÄËÑË÷¹¤¾ß
  • 3. AJAX = Asynchronous + JavaScript + XML + CSS ä¯ÀÀÆ÷µÄ JavaScript ¶ÔÏóÄ£ÐÍ Location ¶ÔÏ󣺷ÃÎʼÓÔØÔÚ´°¿ÚÖеÄÎĵµµÄ URL £¬¿ÉÒÔÓà location ¶ÔÏó´Óµ±Ç°ÍøÒ³¶¨Î»µ½ÁíÒ»¸öÍøÒ³£¬ È磺 location.href=¡° http:// www. ¡± History ¶ÔÏ󣺲鿴×î½ü·ÃÎʹýµÄÍøÖ·ÁÐ±í£¬ È磺 history.go(), history.back()
  • 4. JavaScript Object-based: Ö±¹Û / Ä£¿é»¯ / ¿É¸´Óà JavaScript ²¢²»ÊÇÍêÈ«ÃæÏò¶ÔÏ󣨷â×° / ¸´ºÏ / ¼Ì³Ð / ¶à̬£¬µÈ£©µÄÓïÑÔ ×î¼òµ¥µÄ´´½¨ JavaScript ¶ÔÏóµÄ·½·¨£ºµ÷Óà Object ÀàµÄÄÚ½¨¹¹Ô캯Êý var myObject = new Object(); ´´½¨ÁËÒ»¸ö Object ÀàÐ͵ĶÔÏó myObject, myObject Ö»ÊÇÒ»¸ö¿ÕµÄ¶ÔÏó£¬Ã»ÓÐÈκÎÊôÐԺͷ½·¨¡£ JavaScript ¶ÔÏóÖ»ÊÇÒ»×é¹ØÁªµÄÊý×飬¶ÔÏóµÄÊôÐÔ ( ±äÁ¿ ) ºÍ·½·¨ ( º¯Êý ) ÊÇ¿ÉÒÔͨ¹ýÊý×éϱêºÍÃû×ÖÒýÓõġ£
  • 5. JavaScript ¶ÔÏó ¿É¶Áд var person = new Object(); // ͨ¹ý¡° .¡± ¸ø¶ÔÏóÌí¼ÓÊôÐÔ person.name=¡°Roger¡±; person.sex=¡°male¡±; // ͨ¹ýÊý×éϱêÒýÓà person[0]=¡°Roger¡±; person[1]=¡°male¡±; // ͨ¹ý×Ö·û´®ÊµÏÖ person[¡°name¡±]=¡°Roger¡±; person[¡°sex¡±]=¡°male¡±; ʹÓá° =¡± ²Ù×÷·û³ýÁË¿ÉÒÔÏò¶ÔÏóÌí¼Ó / ÐÞ¸ÄÊôÐÔ£¬»¹¿ÉÒÔ½«·½·¨¶¯Ì¬µØÌí¼Óµ½Ò»¸ö¶ÔÏó£¬È磺 person.sayHello = function() { alert(¡°Hello, my name is ¡± + this.name); }
  • 6. ʹÓà JSON ´´½¨Êý×éºÍ¶ÔÏóͼ JavaScript ¶ÔÏóµÄijһ¸ö³ÉÔ±Ò²¿ÉÒÔÊÇÒ»¸ö¶ÔÏó ¶ÔÏó½á¹¹¸´ÔÓ ¿É¶ÁÐÔ / ¿Éά»¤ÐÔ²î JavaScript Object Notation ÊÇ JavaScript µÄºËÐÄÌØÐÔ var cookbook=new Object(); cookbook.pageCount=100; cookbook.author={ firstName: ¡°Harry¡±, secondName: ¡°Christmas¡±, birthdate: new Date(1900,2,29), interests: [¡°cheese¡±, ¡°basketball¡±, ¡°music¡±] }
  • 7. JavaScript ¹¹Ô캯Êý function Person (name, age){ this.name=name; this.age=age; this.sayHello=function() { alert(¡°my name is ¡± + this.name); } } var myObj = new Person(¡°Roger¡±, 27); Java ÓïÑÔÖÐËùÓÐÀ඼¼Ì³Ð×Ô java.lang.Object Àà JavaScript ûÓÐ Java ÕâÖּ̳еĸÅÄËùÓÐ JavaScript ¶ÔÏó¶¼ÊÇͬһ¸ö»ùÀàµÄʵÀý£¬Õâ¸ö»ùÀàÓµÓÐÔÚÔËÐÐʱ½«³ÉÔ±º¯ÊýºÍ±äÁ¿¶¯Ì¬°î¶¨µ½×ÔÉíµÄÄÜÁ¦¡£ ÉÏÃæµÄ´úÂëȱµã£º a). ¶ÔÓÚ´´½¨µÄÿһ¸ö Person ÀàµÄʵÀý£¬¶¼»á´´½¨Ò»¸öÐ嵀 sayHello º¯Êý£¬Õâ¶ÔÄÚ´æÊÇÒ»¸ö¼«´óµÄÀË·Ñ£¬Èç¹ûÔÚ³ÌÐòÖд´½¨´óÁ¿ÕâÑùµÄ¶ÔÏó£¬ÄÚ´æй¶ÎÊÌâ»á±äµÃÓÈΪÃ÷ÏÔ¡£ b). ÔÚ¹¹Ô캯ÊýÖд´½¨Ò»¸ö±ÕºÏÇøÓò£¬ÔÚÉæ¼°µ½ DOM ʱ£¬½«»á²úÉúÑÏÖصÄÎÊÌâ¡£ ¸üΪ°²È«µÄÌæ´ú·½°¸£ºÍ¨¹ýʹÓà prototype ±äµÃ¸ü¼ÓÃæÏò¶ÔÏó»¯
  • 8. JavaScript -- prototype ͨ¹ýʹÓù¹Ô캯ÊýµÄ prototype £¬ÊôÐÔºÍÐÐÊý¿ÉÒÔ¹ØÁªµ½¶ÔÏóÉÏ¡£ function Person (name, age){ this.name=name; this.age=age; } Person.prototype.sayHello=function() { alert(¡°my name is ¡± + this.name); } var myObj = new Person(¡°Roger¡±, 27); myObj.sayHello(); ×¢ÒâÖ´ÐÐ˳Ðò£ºÍ¨¹ý prototype Ïò JavaScript ¶ÔÏóÌí¼ÓµÄÊôÐԺͷ½·¨ÊÇÔÚ¹¹Ô캯Êýµ÷ÓõÄÄÇÒ»¿Ì¹ØÁªµ½Ëù´´½¨µÄ¶ÔÏóÉÏÈ¥µÄ ¡£
  • 9. JavaScript ¶ÔÏó·´Éä È·¶¨¶ÔÏóÊÇ·ñÓÐij¸öÊôÐÔ£º if (typeof(myObject.someProperty) != ¡°undefined¡±){ ¡­¡­ } ²âÊÔij¸ö¶ÔÏóµÄÀàÐÍ instanceof if (myObj instanceof Array){ ¡­¡­ }
  • 10. Rich Client ¡° ÅÖ¿Í»§¶Ë¡±£ºÏà¶ÔÓÚ¡°ÊÝ¿Í»§¶Ë¡±¶øÑÔ£¬ÔÚ¿Í»§»úÆ÷ÉÏ°²×°ÅäÖõÄÒ»¸ö¹¦ÄܷḻµÄ½»»¥Ê½Óû§½çÃæ¡£ MSN, IE, Oracle, DB2 Êý¾Ý¿â¹ÜÀí¹¤¾ß ´«Í³µÄ Web Ó¦ÓóÌÐò£º¿Í»§¶ËÐè½øÐÐÒ³ÃæÌøת»òˢРAjax ½â¾öÁË£º¸ºÔعý´ó£¬ÏìӦʱ¼ä³¤£¬Í¬²½½»»¥¹ý³Ì´øÀ´µÄ¸Ð¾õ²»Á¬¹á
  • 11. Ajax ¼¼ÊõʹÓà XMLHTTPRequest ¶ÔÏó·¢ËÍÇëÇ󲢵õ½·þÎñÆ÷ÏìÓ¦£¬µÃµ½·µ»ØµÄÊý¾ÝºóÓà JavaScript ²Ù×÷ DOM À´Ê¹Ò³Ãæ¸üÐÂ
  • 12. Cascading Style Sheets Óŵ㣺ÌṩÁË´ÓÄÚÈÝÖзÖÀëÓ¦ÓÃÑùʽºÍÉè¼ÆµÄ»úÖÆ È±µã£ºÊǹ¹½¨¿çä¯ÀÀÆ÷Ó¦ÓõÄÒ»´ó×è°­£¬²»Í¬µÄä¯ÀÀÆ÷³§ÉÌÖ§³Ö²»Í¬µÄ CSS ¼¶±ð¡£ Ëæ×Å XML µÄÒýÈ룬Êý¾ÝÃèÊö³ÉΪµ¥¶ÀµÄ¹¦ÄÜ£¬¶øÑùʽ±íÔò¸ºÔðÏÔʾ£¬ÄÚÈݺÍÑùʽµÄ·ÖÀë¸ø¿ª·¢´øÀ´µÄ¼«´óµØ·½±ã£º¿É¶ÁÐÔ£¬Ò»´ÎÐÔдÈë W3C ¶Ô CSS ±ê×¼µÄ¸Ä½ø£¬Óë¸÷ä¯ÀÀÆ÷°æ±¾¼æÈÝÐÔ
  • 13. CSS Ñùʽ±íÓÉÑùʽ¹æÔò×é³É£¬Ñùʽ¹æÔò°üÀ¨£ºÑ¡Ôñ·ûºÍÑùʽ¶¨Òå Ñ¡Ôñ·û { ÊôÐÔ 1: Öµ 1 £» /* ×¢ÊÍ */ ÊôÐÔ 2: Öµ 2 } ÉêÃ÷·Ö×飬¼Ì³Ð
  • 14. ÄÚ²¿Ñùʽ±í <html> <head><title> ÄÚ²¿Ñùʽ±íÑÝʾ </title> <style type=¡°text/css¡±> h1,h2,h3 { color: blue } /* Ñ¡Ôñ·û·Ö×é */ h1 { /* ÊôÐÔ·Ö×é */ font-weight: bold; font-size: 30pt; font-family: ËÎÌå } h2 { /* ÊôÐÔÖµ·Ö×é */ font: bold 28pt ËÎÌå } </style> </head> <body> ¡­¡­</body> </html>
  • 15. ÍⲿÑùʽ±í Á½ÖÖʹÓ÷½Ê½£ºÁ¬½Óµ½Ñùʽ±íÉÏ£» ÊäÈëÑùʽ±í¡£ ===out.css=== body { background-color: pink } p { margin-left: 20%; margin-right: 20%; font-family: ËÎÌå ; font-size: 14 } <html> <head><title> Á´Ê½Ñùʽ±í </title> <link rel=stylesheet type=¡°text/css¡± href=¡°out.css¡±> </head> <body> ¡­¡­</body> </html> href ¿ÉÒÔÊÇÏà¶Ô·¾¶»ò¾ø¶Ô·¾¶ === ÊäÈëÍⲿÑùʽ±í @import ¿ÉÓëÆäËû·½·¨½áºÏʹÓã¬ÎĵµÖж¨ÒåµÄÆäËûÑùʽ±í¸ñÔò ½«¸²¸ÇÊäÈëÑùʽ±íÖÐ×÷ÓÃÔÚÏàͬ¶ÔÏóÉϵĹæÔò
  • 16. ÑùʽÀà ÑùʽµÄ·ÖÀ࣬¿É¸ù¾Ý²»Í¬µÄ·ç¸ñÐèÒª¶ÔijһÀàÐ͵ıê¼ÇÉèÖü¸ÖÖ²»Í¬µÄ CSS ÊôÐÔ¡£ µÚÒ»ÖÖ¸ñʽ£º ±ê¼Ç . ÑùʽÀàÃû { ÊôÐÔ 1: ÊôÐÔÖµ 1; ÊôÐÔ 2: ÊôÐÔÖµ 2; ÊôÐÔ 3: ÊôÐÔÖµ 3} µÚ¶þÖÖ¸ñʽ£º ÑùʽÀàÃû { ÊôÐÔ 1: ÊôÐÔÖµ 1; ÊôÐÔ 2: ÊôÐÔÖµ 2; ÊôÐÔ 3: ÊôÐÔÖµ 3} µÚ¶þÖÖ·½Ê½¹æ¶¨µÄÑùʽÀàûÓÐÌض¨ÓÚijһÀà±ê¼Ç£¬ÈκÎÀàÐ͵ıê¼Ç¶¼¿ÉÒÔʹÓøÃÑùʽÀà¡£ ʹÓ㺠< ±ê¼Ç class=¡° ÑùʽÀàÃû¡± >
  • 17. CSS ÖеÄÂ˾µ filter: filtername (parameters) filter ÊÇÂ˾µÊôÐÔÑ¡Ôñ·û filtername ÊÇÂ˾µÊôÐÔÃû
  • 18. DOM Óë JavaScript DHTML¡ª ʹÓà JavaScript ²Ù×÷Ò³ÃæÄÚÈݵĹý³Ì DOM¡ª Îĵµ¶ÔÏóÄ£ÐÍ£¬Äܹ»¸üºÃµÄ¿ØÖÆ´°¿ÚÄÚÈݵķ½·¨
  • 19. ʹÓà JavaScript ¶ÁÈ¡ XML Îĵµ <basic country=¡°China¡±> <name num=¡°1¡±>
  • 20. Ajax ¹¤×÷Á÷³Ì Ajax ÊÇʹÓÿͻ§¶Ë½Å±¾Óë Web ·þÎñÆ÷½»»»Êý¾ÝµÄ Web Ó¦Óÿª·¢·½·¨¡£ÕâÑù Web Ò³Ãæ²»Óôò¶Ï½»»¥Á÷³Ì½øÐÐÖØмÓÔØ£¬¾Í¿ÉÒÔ¶¯Ì¬µØ¸üС£ÓйØÊý¾ÝÑéÖ¤ºÍÊý¾Ý´¦Àí¶¼ÓÉ Ajax ÒýÇæÀ´×ö£¬ÐèÒª´Ó·þÎñÆ÷¶ÁÈ¡ÐÂÊý¾ÝʱÔÙÓÉ Ajax ÒýÇæ´úΪÏò·þÎñÆ÷Ìá½»ÇëÇó ʹÓà JavaScript ÖÐ XMLHttpRequest ¶ÔÏó£¨Ö§³ÖÒì²½ÇëÇóµÄ¼¼Êõ£©¿ÉÒÔÏò·þÎñÆ÷Ìá³öÇëÇó²¢´¦ÀíÏìÓ¦£¬Õâ¸ö¹ý³Ì²»»á×èÈûÓû§µÄÆäËû²Ù×÷¡£
  • 22. ¼àÊÓ Response µÄ״̬ ͨ¹ý»Øµ÷º¯Êý¡ª¼àÊÓä¯ÀÀÆ÷µÄ״̬ req.onreadystatechange = callback; // Ö¸¶¨»Øµ÷º¯Êý ²Ù×Ý·µ»ØµÄÊý¾Ý req.responseText req.responseXML function sendRequest(callback, url) { // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); // ´´½¨ XMLHttpRequest req.onreadystatechange = callback; // Ö¸¶¨»Øµ÷º¯Êý req.open(¡°GET¡±, url, true); // ½¨Á¢ÇëÇó req.send(null); // ÈçÓвÎÊý£¬Ôò method ±ØÐëÊÇ post } // branch for IE/Windows ActiveX version else if (window.ActiveXObject) { req = new ActiveXObject(¡°Microsoft.XMLHTTP¡±); if (req) { ¡­¡­ // ͬÉÏ } } } function callback() { if (req.onreadystate == 4) { // ÅжϾÍÐ÷״̬ if (req.status == 200) { parseMessage(); // ½ÓÊÕ·µ»ØµÄÊý¾Ý } else { alert(¡°Not able to retrieve description¡± + req.statusText) ; } } else {} } function parseMessage() { var xmldoc = req.responseXML; // »ñÈ¡·µ»ØµÄ½á¹û var name = xmldoc.getElementByTagName(¡°author¡±); // »ñÈ¡ÎļþÖÐ <author> ±ê¼Ç var content = document.getElementById(¡°display¡±); // »ñÈ¡ÍøÒ³ÖÐ <display> ±ê¼Ç content.innerHTML = name; // ÔÚÍøÒ³ÖÐÏÔʾ }
  • 23. Ajax ʵÀý ÌáʾµÈ´ý ¼¶ÁªÏÂÀ­¿ò Google suggest ºÝºÝߣr £¨»¬¿é£© ÌáʾµÈ´ý£º ÔÚ״ֵ̬²»µÈÓÚ 4 ʱ¶Ô HTML ´úÂë½øÐÐһЩÐ޸ģ¬ÈÃÒ³ÃæÏÔʾһЩÌáʾÐÅÏ¢¡£ ¼¶ÁªÏÂÀ­¿ò£º ¿Ø¼þ B µÄÄÚÈÝÈ¡¾öÓڿؼþ A µÄÄÚÈÝ£¬Çҿؼþ B µÄÄÚÈÝÐèÒª¸ù¾Ý¿Ø¼þ A µÄÄÚÈÝÔÙ´Ó·þÎñÆ÷¶Ë»ñµÃÏàÓ¦Êý¾Ý¡£ ÔÚ A µÄ onChange ʼþ·¢Éúʱµ÷ÓÃÒ»¸öº¯Êý£¬´´½¨ XMLHttpRequest ¶ÔÏóÀ´ºÍ·þÎñÆ÷½øÐн»»¥£¬Ïò·þÎñÆ÷·¢ËÍÇëÇ󣬲ÎÊýΪÏÂÀ­¿ò A ÖÐÑ¡¶¨µÄÄÚÈÝ¡£¿Í»§¶ËÔÚ½ÓÊÕµ½·þÎñÆ÷´¦ÀíºóµÄÊý¾Ýºó£¬ÏȶÔÊý¾Ý½øÐд¦Àí£¬ÔÙÏÔʾµ½ÏÂÀ­¿ò B ÖС£ »¬¿é -- ÊÇÒ»¸ö¿ÉÒÔËæÒâÍ϶¯¶ø¸Ä±äÏàÓ¦ÖµµÄ¿Ø¼þ Í϶¯°´Å¥µÃµ½Ò»¸öеķ¶Î§ºó£¬¾Í´´½¨Ò»¸ö XMLHttpRequest ¶ÔÏóÀ´ºÍ·þÎñÆ÷½øÐн»»¥£¬²ÎÊý¾ÍÊÇ»¬¿éµ±Ç°Ö¸¶¨·¶Î§µÄ×îСֵºÍ×î´óÖµ¡£
  • 24. Google suggest µ±ÔÚÎı¾¿òÖÐÊäÈë²éѯÄÚÈÝʱ£¬Îı¾¿ò¿Ø¼þ»áÏìÓ¦ onkeyup ʼþ£¬ ÔÚÕâ¸öʼþÖе÷Óà javascript º¯ÊýÀ´´´½¨ XMLHttpRequest ¶ÔÏóºÍ·þÎñÆ÷½øÐн»»¥£¬Ïò·þÎñÆ÷·¢ËÍÇëÇ󣬲ÎÊýΪÎı¾¿òÖеÄÄÚÈÝ¡£·þÎñÆ÷½ÓÊÕµ½ÇëÇóºó£¬½«²ÎÊý×÷Ϊ²éѯÌõ¼þµÃµ½²éѯ½á¹û·µ»Øµ½¿Í»§¶Ë¡£¿Í»§¶Ë½ÓÊÕµ½ÕâЩ·µ»ØµÄÊý¾Ýºó£¬ÔÚÎı¾¿òÏ·½¹¹ÔìÒ»¸öÁÐ±í£¬À´ÏÔʾÕâЩƥÅä²éѯÌõ¼þµÄ¿ÉÑ¡Öµ¡£ÔÚÏÔʾ¹ý³ÌÖУ¬»¹Ðè¶ÔÓû§°´¼ü×ö³öһϵÁÐÅжϣ¬ÊµÏÖÓѺý»»¥¡£ ¶¨ÒåÑùʽÎļþ style.css ÓÃÀ´¿ØÖÆÏÂÀ­Ìáʾ¿ò¡¢Æ¥ÅäµÄÎı¾µÈµÄÏÔʾÑùʽ build.js
  • 25. Ajax µÄ°²È«ÎÊÌâ Ajax µÄ°²È«ÎÊÌâºÍÐÔÄÜÎÊÌâ JavaScript ºÍä¯ÀÀÆ÷µÄ°²È«ÐÔ ¿Í»§¶Ë½Å±¾ÓïÑÔ£¨°²È«ÐÔÎÊÌ⣩ -- µ±·ÃÎÊÒ»¸öʹÓà Ajax ¼¼Êõ¹¹½¨µÄ Web Ó¦ÓÃʱ£¬ Web ·þÎñÆ÷»á½«Ò»ÏµÁÐ JavaScript ½Å±¾´úÂë·¢Ë͵½Ã¿Ò»¸ö·ÃÎÊÕߵĻúÆ÷ÉÏ£¬È»ºóÓû§ä¯ÀÀÆ÷±ã»áÔÚ±¾µØÖ´ÐÐÕâЩ´úÂë 1). JavaScript ÐÞ¸ÄϵͳÉèÖã¨×¢²á±í£¬¸ñʽ»¯Ó²ÅÌ£¬¶ñÒâÆÆ»µ£© 2). IFrame ÎÊÌ⣺ÍøÒ³ÖÐ IFrame Ö¸¶¨µÄÔªËØ¿ÉÒÔ´ÓÆäËûÓò¼ÓÔØÍøÒ³²¢Ö´ÐÐ HTML ´úÂ룬Ï൱ÓÚǶÔÚÍøÒ³ÄÚ²¿µÄÒ»¸ö¶ÀÁ¢¿ò¼Ü´°¿Ú£¬µ«²»Í¬ÓòµÄ JavaScript È´²»ÄÜ»¥Ïà·ÃÎÊ¡£
  • 26. JavaScript µÄÐÔÄÜÎÊÌ⣨½âÊÍÐÍÓïÑÔ£© 1). Ñ­»·£¬ ЧÂÊ£º while() better than for( ; ; ) better than for( in ) ²éѯɢÁмü 2). ¾Ö²¿±äÁ¿ ( ·ÅÔÚº¯ÊýµÄ¶ÑÕ»ÖÐ ) ·ÃÎÊËÙ¶È better than È«¾Ö±äÁ¿ 3). ÉÙÓà eval £¬Ê¹Óà eval Ï൱ÓÚÔËÐÐʱÔٴε÷ÓýâÊÍÒýÇæ¶ÔÄÚÈݽøÐнâÊÍÔËÐС£¿ÉʹÓà JavaScript ±Õ°üʵÏÖÄ£°æ´úÌæ eval º¯Êý¡£ 4). ʹÓþֲ¿±äÁ¿£¬¼õÉÙ¶ÔÏó²éÕÒ£¨½âÊÍÓïÑÔ£© var len = a.length; 5). s += a; better than s = s + a; s += a + b +c; better than s+=a; s+=b; s+=c; 6). ÀàÐÍת»»£¨ÈõÀàÐÍ£©£¬ ( ¡°¡± + ) > String() > .toString() > new String() 7). ʹÓÃÖ±½ÓÁ¿£¬ var foo = { }; ½âÊÍÒýÇæÖ±½Ó½âÊÍ > var foo = new Object(); ÄÚ²¿¹¹ÔìÆ÷ var reg = /¡­/; faster than var reg = new RegExp() 8). ¶Ô×Ö·û´®½øÐеÄÑ­»·²Ù×÷£¬ÈçÌæ»»¡¢²éÕÒ£¬Ó¦ÓÅÏÈʹÓÃÕýÔò±í´ïʽ£¨ C ÓïÑÔдµÄ API £© 9). ¸´Óûò»º´æÒÔ¼õÉÙ´´½¨¸ß¼¶¶ÔÏó£¬È磺 Date ¡¢ RegExp 10). Ö±½ÓʹÓÃϱê·ÃÎÊ¿ìÓÚʹÓá° .¡± 11). ´´½¨ DOM ½Úµã£ºÊ¹ÓÃ×Ö·û´®Ö±½Óд HTML Óï¾äÀ´´´½¨½Úµã ЧÂʵÍÓÚ Ê¹Óà document.createElement() ·½·¨£¬ Èç¹ûÎĵµÖдæÔÚÏֳɵÄÑù°å½Úµã£¬¿ÉÒÔʹÓà cloneNode() À´¼õÉÙ¶à´ÎÉèÖÃÔªËصÄÊôÐÔ¡£
  • 28. µ±Ç°ÉÌÒµÐÍÏîÄ¿Öж¼ÐèÒªÓÐËÑË÷µÄ¹¦ÄÜ ÓÐЩ¿ÉÒÔͨ¹ý SQL À´ÊµÏÖËÑË÷ ¶ÔÓÚÈ«ÎļìË÷£¨Èç¶ÔÒ»¸ö¹«Ë¾ 5 ÄêÀ´ËùÓб¨±íÊý¾ÝºÍ»áÒé¼Ç¼µÄËÑË÷£©£¬Êý¾Ý¿âµÄËٶȺÍÐÔÄÜÎÞ·¨Âú×ãÐèÇó ¹ºÂò Google µÈ¹«Ë¾µÄËÑË÷·þÎñ ×Ô¼º¿ª·¢ËÑË÷ÒýÇæ ebay ¡­ ʹÓà Apache ¿ªÔ´È«ÎļìË÷¹¤¾ß°ü Lucene ·½±ãµØ¹¹½¨×Ô¼ºµÄËÑË÷ÒýÇæ (Eclipse ¾ÍÊÇʹÓà Lucene ×÷ΪÆäÄÚ½¨µÄËÑË÷¹¤¾ß )
  • 29. ÐÅÏ¢»ñÈ¡ ÓëËÑË÷ÒýÇæ ÐÅÏ¢»ñÈ¡£º °üº¬ÐÅÏ¢µÄ±íʾ¡¢´æ´¢¡¢×éÖ¯ºÍ¶ÔÐÅÏ¢µÄ·ÃÎÊ·½·¨¡£ Êý¾Ý Ë÷Òý ¼ìË÷ ÅÅÐò a. ¹¹ÔìÎı¾Êý¾Ý¿â £¬´æ·Å½«À´ÐèÒª¼ìË÷µÄÊý¾Ý b. ½¨Á¢ÎĵµµÄË÷Òý £¬ÓÃÀ´Ìá¸ßÐÅÏ¢¼ìË÷Ëٶȡ£È磬µ¹ÅÅË÷Òý¼¼Êõ c. ÀûÓÃÎı¾´¦Àí¼¼Êõ ·ÖÎöÓû§µÄ²éѯ ¡£ÔÚ½øÐвéѯ֮ǰ»¹¿ÉÒÔ½øÐÐһЩÓë´¦Àí¡£ d. ¶Ô¼ìË÷½á¹û½øÐд¦Àí £¨ÅÅÐò£© DB/File ¿Í»§ÊäÈë²éѯÌõ¼þ ·´À¡¿Í»§²éѯ½á¹û ÐÅÏ¢
  • 30. ÐÅÏ¢»ñÈ¡Óë ËÑË÷ÒýÇæ ËÑË÷ÒýÇ棺 È«ÎÄËÑË÷ÒýÇæ £¨ FullText Search Engine £© £ºÍ¨¹ýÒ»¸ö½ÐÍøÂç»úÆ÷ÈË»ò½ÐÍøÂçÖ©ÖëµÄÈí¼þ£¬×Ô¶¯·ÖÎöÍøÂçÉϵĸ÷ÖÖÁ´½Ó²¢»ñÈ¡ÍøÒ³ÐÅÏ¢ÄÚÈÝ£¬°´¹æÔò¼ÓÒÔ·ÖÎöÕûÀí£¬¼ÇÈëÊý¾Ý¿â¡£µäÐ͵ÄϵͳÓУº Google ºÍ°Ù¶È ·ÖÀàĿ¼ £¨ Directory £© £ºÔòÊÇ Í¨¹ýÈ˹¤µÄ·½Ê½ÊÕ¼¯ÕûÀíÍøÕ¾×ÊÁÏÐγɵÄÊý¾Ý¿â £¬ÈçÑÅ»¢Öйú¡¢ËѺü¡¢ÐÂÀË¡¢ÍøÒ×µÈÍøÕ¾µÄ·ÖÀàĿ¼¡£ µÚÒ»´úËÑË÷ÒýÇ棺ÒÀ¿¿È˹¤·Ö¼ðµÄ·ÖÀàĿ¼ËÑË÷£¬ e.g. yahoo µÚ¶þ´úËÑË÷ÒýÇ棺ÒÀ¿¿»úÆ÷ץȡ£¬²¢½¨Á¢ÔÚ³¬¼¶Á´½Ó·ÖÎö¼¼Êõ»ù´¡Ö®ÉϵÄÍøÒ³ËÑË÷£¬ e.g. Google Ìص㣺ÐÅÏ¢Á¿´ó£¬¸üм°Ê±£¬µ«·µ»ØÎÞ¹ØÐÅÏ¢¹ý¶à µÚÈý´úËÑË÷ÒýÇ棺ÈÚÈë¡°ÖÇÄÜ»¯¡±£¬¡°ÈË»ú½»»¥¡±¹¦ÄÜ¡£½«×Ô¶¯·ÖÀ༼Êõ£¬ÖÐÎÄÄÚÈÝ·ÖÎö¼¼Êõ¼°ÇøÓòʶ±ð¼¼ÊõÓ¦Óõ½´óÐÍËÑË÷ÒýÇæÖÐ ¡£ ÐÅÏ¢¸üÐÂËٶȿ죬ƵÂÊ¸ß ÍøÒ³Ïà¹Ø¼ìË÷£¬Æ´Òô¾À´í£¬Ä£ºý²éѯ£¬ÓïÒô²éѯ¼¼ÊõÓкܸßË®×¼¡£ ´ËÍ⣬»¹Í¬Ê±¼æ±¸ÁËÐÂÎÅ£¬ MP3 £¬Í¼Æ¬£¬ Flash ËÑË÷¹¦ÄÜ¡£
  • 31. È«ÎļìË÷ È«ÎļìË÷£º¼ÆËã»úË÷Òý³ÌÐòͨ¹ýɨÃèÎÄÕÂÖеÄÿһ¸ö´Ê£¬¶Ôÿһ¸ö´Ê½¨Á¢Ò»¸öË÷Òý£¬Ö¸Ã÷¸Ã´ÊÔÚÎÄÕÂÖгöÏֵĴÎÊýºÍλÖ㬵±Óû§²éѯʱ£¬¼ìË÷³ÌÐò¸ù¾ÝÊÂÏȽ¨Á¢µÄË÷Òý½øÐвéÕÒ£¬²¢½«²éѯ½á¹û·´À¡¡£ °´×Ö¼ìË÷ £¬¶ÔÓ¢ÎÄ£¬×ÖÓë´ÊºÏÒ»£¬ÖÐÎÄÓкܴóÇø±ð£» °´´Ê¼ìË÷ £¬¶ÔÓïÒ嵥뽨Á¢Ë÷Òý£¬¼ìË÷ʱ°´´Ê¼ìË÷£¬²¢¿ÉÒÔ´¦ÀíͬÒåÏî¡£ ÖÐÎÄÎÄ×ÖµÄÇзÖ×Ö´ÊÊÇÈ«ÎļìË÷µÄ¼¼ÊõÄѵ㡣
  • 32. È«ÎļìË÷ϵͳ È«ÎļìË÷ϵͳ£º¾ßÓÐ ½¨Á¢Ë÷Òý ¡¢ ´¦Àí²éѯ·µ»Ø½á¹û¼¯ ¡¢ Ôö¼ÓË÷Òý ¡¢ ÓÅ»¯Ë÷Òý½á¹¹ µÈ¹¦ÄÜ£¬ÍâΧÔòÓɸ÷ÖÖ²»Í¬Ó¦ÓþßÓеŦÄÜ×é³É¡£ ²éѯÒýÇæ Îı¾´¦ÀíÒýÇæ Ë÷ÒýÒýÇæ ¶þ´Î¿ª·¢Ó¦ÓÃ½Ó¿Ú Ó¦ÓóÌÐò Web ³ÌÐò ÆäËû ´ÅÅÌË÷ÒýÎļþ
  • 33. È«ÎļìË÷ ¡Ù like &quot;%keyword%&quot; ÓÉÓÚÊý¾Ý¿âË÷Òý²»ÊÇΪȫÎÄË÷ÒýÉè¼ÆµÄ£¬ µ±Ê¹Óà like ¡°%word%¡± ʱ£¬Êý¾Ý¿âË÷ÒýÊDz»Æð×÷ÓÃµÄ £¬ËùÒÔ¶ÔÓÚº¬ÓÐÄ£ºý²éѯµÄÊý¾Ý¿â·þÎñÀ´Ëµ£¬ LIKE ¶ÔÐÔÄܵÄΣº¦ÊǼ«´óµÄ¡£Èç¹ûÊÇÐèÒª¶Ô¶à¸ö¹Ø¼ü´Ê½øÐÐÄ£ºýÆ¥Å䣺 like ¡°%word1%¡° and like ¡±%word2%¡± ÆäЧÂÊÒ²¾Í¿ÉÏë¶øÁË¡£ ½¨Á¢Ò»¸ö¸ßЧ¼ìË÷ϵͳµÄ ¹Ø¼üÊǽ¨Á¢Ò»¸ö·´ÏòË÷Òý»úÖÆ £¬½«Êý¾ÝÔ´£¨±ÈÈç¶àƪÎÄÕ£©ÅÅÐò˳Ðò´æ´¢µÄͬʱ£¬ÓÐÁíÍâÒ»¸öÅźÃÐòµÄ¹Ø¼ü´ÊÁÐ±í£¬ÓÃÓÚ´æ´¢¹Ø¼ü´Ê => ÎÄÕÂÓ³Éä¹Øϵ£¬ ÀûÓÃÕâÑùµÄÓ³Éä¹ØϵË÷Òý£º [ ¹Ø¼ü´Ê => ³öÏֹؼü´ÊµÄÎÄÕ±àºÅ£¬³öÏÖ´ÎÊý£¬³öÏÖƵÂÊ ] £¬¼ìË÷¹ý³Ì£º °ÑÄ£ºý²éѯ±ä³É¶à¸ö¿ÉÒÔÀûÓÃË÷ÒýµÄ¾«È·²éѯµÄ Âß¼­×éºÏ µÄ¹ý³Ì ¡£
  • 34. Lucene Lucene ÊÇÒ»¸ö¿ª·ÅÔ´´úÂëµÄÈ«ÎļìË÷ÒýÇ湤¾ß°ü£¬ÊÇ Apache Èí¼þ»ù½ð»á Jakarta ÏîÄ¿µÄ×ÓÏîÄ¿¡£ Lucene ²»ÊÇÒ»¸öÍêÕûµÄÈ«ÎļìË÷ÒýÇ棬¶øÊÇÒ»¸öÈ«ÎļìË÷ÒýÇæµÄ¼Ü¹¹£¬ÌṩÍêÕûµÄ²éѯÒýÇæºÍË÷ÒýÒýÇæ¼°²¿·ÖÎı¾·ÖÎöÒýÇ棨×î³õ£ºÓ¢ÎÄ¡¢µÂÎÄ£©¡£ ²»Í¬³ÌÐòÓïÑÔ°æ±¾ (.Net £¬ C £¬ for script language: ruby, python)
  • 35. Lucene È«ÎļìË÷ʵÏÖ»úÖÆ Lucene µÄ API ½Ó¿ÚÉè¼ÆµÄ±È½ÏͨÓã¬ÊäÈëÊä³ö½á¹¹¶¼ºÜÏñÊý¾Ý¿âµÄ ±í ==> ¼Ç¼ ==> ×ֶΠ£¬ËùÒԺܶഫͳµÄÓ¦ÓõÄÎļþ¡¢Êý¾Ý¿âµÈ¶¼¿ÉÒԱȽϷ½±ãµÄÓ³Éäµ½ Lucene µÄ´æ´¢½á¹¹ / ½Ó¿ÚÖС£×ÜÌåÉÏ¿´£º¿ÉÒÔÏÈ°Ñ Lucene µ±³ÉÒ»¸öÖ§³ÖÈ«ÎÄË÷ÒýµÄÊý¾Ý¿âϵͳ ¡£ RecordSet £º²éѯ½á¹û¼¯£¬Óɶà¸ö Record ×é³É Hits £º²éѯ½á¹û¼¯£¬ÓÉÆ¥ÅäµÄ Document ×é³É 2.3 -> TopDocCollector collector = new TopDocCollector(10); Field £º×ֶΠField £º×ֶΠRecord £º¼Ç¼£¬°üº¬¶à¸ö×ֶΠDocument £ºÒ»¸öÐèÒª½øÐÐË÷ÒýµÄ¡°µ¥Ôª¡± Ò»¸ö Document Óɶà¸ö×Ö¶Î×é³É Ë÷ÒýÊý¾ÝÔ´£º record(field1,field2...) record(field1..) SQL: insert/ _____________ | DB Index | ------------- / SQL: select ½á¹ûÊä³ö£º results(record(field1,field2..) record(field1...)) Ë÷ÒýÊý¾ÝÔ´£º doc(field1,field2...) doc(field1,field2...) indexer / _____________ | Lucene Index| -------------- / searcher ½á¹ûÊä³ö£º Hits(doc(field1,field2) doc(field1...)) Database Lucene
  • 36. È«ÎļìË÷ ºÍ Êý¾Ý¿âÓ¦Óà ×î´óµÄ ²»Í¬ ÔÚÓÚ£º ÈÃ×îÏà¹ØµÄÍ· 100 Ìõ½á¹ûÂú×ã 98% ÒÔÉÏÓû§µÄÐèÇó ¡£ ûÓнӿڻò½Ó¿Ú¸´ÔÓ£¬ÎÞ·¨¶¨ÖÆ ¡£ ͨ¹ý²»Í¬µÄÓïÑÔ·ÖÎö½Ó¿ÚʵÏÖ£¬¿ÉÒÔ·½±ãµÄ¶¨ÖƳö·ûºÏÓ¦ÓÃÐèÒªµÄË÷Òý¹æÔò£¨°üÀ¨¶ÔÖÐÎĵÄÖ§³Ö£© ¿É¶¨ÖÆÐÔ Ê¹ÓÃÂʵͣ¬Ä£ºýÆ¥Åä¹æÔò¼òµ¥»òÕßÐèҪģºý²éѯµÄ×ÊÁÏÁ¿ÉÙ ¸ß¸ºÔصÄÄ£ºý²éѯӦÓã¬ÐèÒª¸´ÔÓµÄÄ£ºý²éѯ¹æÔò£¬Ë÷ÒýµÄ×ÊÁÏÁ¿±È½Ï´ó ½áÂÛ ·µ»ØËùÓеĽá¹û¼¯£¬ÔÚÆ¥ÅäÌõÄ¿·Ç³£¶àµÄʱºòÐèÒª´óÁ¿µÄÄÚ´æ´æ·ÅÕâЩÁÙʱ½á¹û¼¯¡£ ͨ¹ýÌرðµÄËã·¨£¬½«×îÆ¥Åä¶È×î¸ßµÄÍ· 100 Ìõ½á¹ûÊä³ö£¬½á¹û¼¯ÊÇ»º³åʽµÄСÅúÁ¿¶ÁÈ¡µÄ¡£ ½á¹ûÊä³ö ûÓÐÆ¥Åä³Ì¶ÈµÄ¿ØÖÆ£º±ÈÈçÓмǼÖÐ net ³öÏÖ 5 ´ÊºÍ³öÏÖ 1 ´ÎµÄ£¬½á¹ûÊÇÒ»ÑùµÄ¡£ ÓÐÆ¥Åä¶ÈËã·¨£¬½«Æ¥Åä³Ì¶È£¨ÏàËƶȣ©±È½Ï¸ßµÄ½á¹ûÅÅÔÚÇ°Ãæ¡£ Æ¥Åä¶È ʹÓ㺠like ¡°%net%¡± »á°Ñ netherlands ҲƥÅä³öÀ´£»Ê¹Óà like &quot;%com%net%&quot; £º¾Í²»ÄÜÆ¥Åä´ÊÐòµßµ¹µÄ xxx.net..xxx.com ͨ¹ý´ÊÔª (term) ½øÐÐÆ¥Å䣬ͨ¹ýÓïÑÔ·ÖÎö½Ó¿ÚµÄʵÏÖ£¬¿ÉÒÔʵÏÖ¶ÔÖÐÎĵȷÇÓ¢ÓïµÄÖ§³Ö¡£ Æ¥ÅäЧ¹û ¶ÔÓÚ LIKE ²éѯÀ´Ëµ£¬Êý¾Ý´«Í³µÄË÷ÒýÊǸù±¾Óò»Éϵġ£ ½«Êý¾ÝÔ´ÖеÄÊý¾Ý¶¼Í¨¹ýÈ«ÎÄË÷ÒýÒ»Ò»½¨Á¢·´ÏòË÷Òý Ë÷Òý Êý¾Ý¿â Lucene È«ÎÄË÷Òý
  • 37. Lucene µÄ´´ÐÂÖ®´¦ ´ó²¿·ÖµÄËÑË÷£¨Êý¾Ý¿â£©ÒýÇ涼ÊÇÓà B Ê÷½á¹¹À´Î¬»¤Ë÷Òý£¬Ë÷ÒýµÄ¸üлᵼÖ´óÁ¿µÄ IO ²Ù×÷¡£ Lucene ¶Ô´ËÉÔ΢ÓÐËù¸Ä½ø£º ²»ÊÇά»¤Ò»¸öË÷ÒýÎļþ£¬¶øÊÇÔÚÀ©Õ¹Ë÷ÒýµÄʱºò²»¶Ï´´½¨ÐµÄË÷ÒýÎļþ£¬È»ºó¶¨ÆڵİÑÕâЩеÄСË÷ÒýÎļþºÏ²¢µ½Ô­ÏȵĴóË÷ÒýÖÐ £¨Õë¶Ô²»Í¬µÄ¸üвßÂÔ£¬Åú´ÎµÄ´óС¿ÉÒÔµ÷Õû£©£¬ÕâÑùÔÚ²»Ó°Ïì¼ìË÷µÄЧÂʵÄÇ°ÌáÏ£¬Ìá¸ßÁËË÷ÒýµÄЧÂÊ¡£ Lucene ²¢Ã»Óй涨Êý¾ÝÔ´µÄ¸ñʽ£¬¶øÖ»ÌṩÁËÒ»¸öͨÓõĽṹ£¨ Document ¶ÔÏó£©À´½ÓÊÜË÷ÒýµÄÊäÈ룬Òò´ËÊäÈëµÄÊý¾ÝÔ´¿ÉÒÔÊÇ£ºÊý¾Ý¿â£¬ WORD Îĵµ£¬ PDF Îĵµ£¬ HTML Îĵµ¡­¡­Ö»ÒªÄܹ»Éè¼ÆÏàÓ¦µÄ½âÎöת»»Æ÷½«Êý¾ÝÔ´¹¹Ôì³É Docuement ¶ÔÏ󼴿ɽøÐÐË÷Òý¡£
  • 38. Ë÷Òý Óë ËÑË÷ Ë÷Òý -- ÌØÊâµÄÊý¾Ý½á¹¹£¬Ìá¸ßËÑË÷ЧÂÊ£¬²»Ö§³Ö¿ìËÙÐÅÏ¢¸üУ¬¶¨ÆÚ¸üÐÂË÷Òý¡£ Ë÷Òý¼¼Êõ£ºµ¹ÅÅË÷Òý£¨¶ÔÓڹؼü´ÊµÄËÑË÷·Ç³£ÓÐЧ£¬ Lucene £©£¬ ºó׺Êý×飨¶ÌÓï²éѯËٶȿ죬Êý¾Ý½á¹¹¹¹Ôìά»¤¸´ÔÓ£©£¬ Ç©ÃûÎļþ£¨Á÷ÐÐÓÚ 20 ÊÀ¼Í 80 Äê´ú£¬±»µ¹ÅÅË÷Òý³¬Ô½£© ËÑË÷ ¨C ΪÓû§Ìṩ¸ßÖÊÁ¿£¨ÏìӦʱ¼ä¡¢×¼È·¶È£©µÄËÑË÷½á¹û¡£¸ßЧµÄËÑË÷Ëã·¨¼°¶ÔËÑË÷½á¹û·á¸»µÄÅÅÐò·½·¨
  • 39. µ¹ÅÅË÷Òý Îĵµ A £º This is a dog B £º This dog is a kind of animal ÈçÓÒͼ ͨ¹ý±È½Ï£º Ò»°ãµÄË÷Òý½á¹¹½¨Á¢µÄÊÇÒ»ÖÖ¡°Îĵµµ½µ¥´Ê¡±µÄÓ³Éä¹Øϵ£¬ ¶øµ¹ÅÅË÷Òý½¨Á¢µÄÔòÊÇÒ»ÖÖ¡°µ¥´Êµ½Îĵµ¡±µÄÓ³Éä¹Øϵ¡£ Óû§ÔÚ½øÐмìË÷ʱ£¬¶¼ÊÇÊäÈë¹Ø¼ü×Ö½øÐвéѯ£¬Èç¹ûʹÓÃÒ»°ãµÄË÷Òý½á¹¹£¬ÔÚ²éѯijһ¹Ø¼ü×ÖʱÐèÒª±éÀúËùÓÐË÷Òý£¬Ë÷ÒýÁ¿´óʱ£¬Ð§Âʲ 1 B kind 1 kind B 1 dog B 1 B animal 1,1 A,B dog ³öÏÖ´ÎÊý ³öÏÖµÄÎĵµ µ¥´Ê µ¹ÅÅË÷Òý½á¹¹ 1 animal B 1 dog A ³öÏÖ´ÎÊý ³öÏÖµ¥´Ê Îĵµ±àºÅ Ò»°ãË÷Òý½á¹¹
  • 40. Lucene ʹÓà Lucene À´Îª±¾µØÎļþ½¨Á¢Ë÷Òý
  • 42. Lucene ½¨Á¢Ë÷Òý¹ý³Ì 1). ÌáÈ¡Îı¾£º ´Ó¸÷ÖÖÎĵµÖÐÌáÈ¡Îı¾ÐÅÏ¢ 2). ¹¹½¨ Document ½«ÌáÈ¡³öµÄÎı¾×é×°³É Lucene ¿ÉÒÔʶ±ðµÄ¸ñʽÀ´ÎªË÷Òý½¨Á¢×ö×¼±¸ 3). ·ÖÎö ¶ÔÒª½¨Á¢Ë÷ÒýµÄÊý¾Ý½øÐзÖÎö£¬Ê¹½¨Á¢Ë÷Òýʱ¸üÈÝÒ×´¦ÀíÊý¾Ý 4). ½¨Á¢Ë÷Òý µ÷Óà IndexWriter ÀàµÄ addDocument() ·½·¨½¨Á¢Ë÷Òý¡£
  • 43. Lucene -- Document Lucene µÄ Document ´ú±íÁËÒ»¸öÐèÒª½øÐÐ Ë÷ÒýµÄ¡°µ¥Ôª¡±£¬ ÈκÎÐèÒª½øÐÐË÷ÒýµÄÊý¾ÝÔ´£¨È磺Îļþ£© ¶¼±ØÐ뱻ת»¯³É Document ¶ÔÏó ²ÅÄܹ»±»Ë÷ÒýºÍËÑË÷µ½¡£
  • 44. Lucene -- IndexWriter ¹¦ÄÜ£º½«Îĵµ¼ÓÈëË÷Òý£¬Í¬Ê±¿ØÖÆË÷Òý¹ý³ÌÖеĸ÷ÖÖ²ÎÊý¡£ ³õʼ»¯£º ²ÎÊý£º Ë÷Òý´æ·ÅµÄ·¾¶£º String, java.io.File, Directory IndexWriter writer1 = new IndexWriter(¡°c:index1¡±, new StandardAnalyzer(), true); File f = new File(¡°c:index2¡±); IndexWriter writer2 = new IndexWriter(f, new StandardAnalyzer(), true); Directory d = new RAMDirectory(); IndexWriter writer3 = new IndexWriter(d, new StandardAnalyzer(), true); ·ÖÎöÆ÷£ºÔÚ IndexWriter ½«ÎĵµÐ´ÈëË÷ÒýÇ°£¬°ÑÎı¾ÐÅÏ¢ÇзֳÉÒ»¸ö¸ö¿ÉÒÔ½øÐÐË÷ÒýµÄ´ÊÌõ¡£¼Ì³Ð×Ô org.apache.lucene.analysis.Analyzer ÀàµÄ·ÖÎöÆ÷ ÖØд´½¨Ë÷Òý true/ ÔöÁ¿Ë÷Òý false
  • 45. Lucene -- IndexWriter ÏòË÷ÒýÌí¼ÓÎĵµ µ÷ÕûÐÔÄܲÎÊý 1. mergeFactor £ºÄ¬ÈÏֵΪ 10 £¬ÓÃÀ´¿ØÖÆ lucene ÔÚ°ÑË÷Òý´ÓÄÚ´æдÈë´ÅÅÌÉϵÄÎļþϵͳʱÄÚ´æÖÐ×î´óµÄ Document ÊýÁ¿¼°×î´ó Segment ÊýÁ¿¡£Ó°Ï콨Á¢Ë÷ÒýʱËù»¨·ÑµÄ´ÅÅÌ I/O ʱ¼äºÍÄÚ´æ¡£ÉèÖÃ̫С£¬ I/O ²Ù×÷Ƶ·±£¬¾­³£½øÐÐ segment ºÏ²¢£¬ÉèÖÃÌ«´ó£¬ÄÚ´æÖгÖÓÐµÄ Document ÊýÁ¿¶à£¬½¨Á¢Ë÷Òý¿ì£¬µ«´óÁ¿Õ¼ÓÃÄÚ´æ¡£ public void setMergeFactor( int mergeFactor) { getLogMergePolicy().setMergeFactor(mergeFactor); } 2. maxMergeDocs £ºÏÞÖÆÒ»¸ö segment ÖÐ×î´óµÄÎĵµÊýÁ¿¡£ public void setMaxMergeDocs( int maxMergeDocs) { getLogMergePolicy().setMaxMergeDocs(maxMergeDocs); } ÏÞÖÆ Field ³¤¶È£º maxFieldLength £¬Ä¬ÈÏֵΪ 10000 £¬Ö»¶ÔÇ° 10000 ¸ö term Ë÷Òý¡£
  • 46. Lucene µÄË÷ÒýÎļþ¸ñʽ ¹æ¶¨ÁË Lucene µÄÎļþ¸ñʽ²ÉÈ¡µÄ´æ´¢µ¥Î»¡¢×éÖ¯½á¹¹¡¢ÃüÃû¹æ·¶µÈµÈÄÚÈÝ Ë÷ÒýÎļþ¸ñʽ£º¶àÎļþË÷ÒýÎļþ¸ñʽ¡¢¸´ºÏË÷Òý¸ñʽ setUseCompoundFile( boolean isCompoundFile)
  • 47. Lucene Îļþ¸ñʽÖж¨ÒåµÄÊý¾ÝÀàÐÍ ÔÚ Lucene µÄÎļþ¸ñʽÖУ¬ÒÔ×Ö½ÚΪ»ù´¡£¬²¢ÇÒ¶¨ÒåÁË×ÔÉíµÄÊý¾ÝÀàÐÍ . ÓÉÓÚËüÃǶ¼ÒÔ×Ö½ÚΪ»ù´¡¶¨Òå¶øÀ´£¬Òò´Ë±£Ö¤ÁËÊÇƽ̨Î޹أ¬ÕâÒ²ÊÇ Lucene Ë÷ÒýÎļþ¸ñʽƽ̨Î޹صÄÖ÷ÒªÔ­Òò .
  • 48. Lucene Ë÷ÒýÎļþ¸ÅÄî½á¹¹ Segment £ºÒ»¸ö¶ÎÊÇÒ»¸ö¶ÀÁ¢µÄË÷Òý£¬¿ÉÒÔÓÉ IndexSearcher ½øÐе¥¶À²éÕÒ¡£ Lucene µÄ¹¤×÷Æäʵ¾ÍÊDz»Í£µØÍù´ÅÅ̼ÓÈëÐ嵀 Segment £¬²¢°´Ò»¶¨µÄËã·¨ºÏ²¢²»Í¬µÄ Segment ÒÔ´´½¨Ò»¸öеĶΡ£ Ï Term £©ÊÇ×îСµÄË÷Òý¸ÅÄ룬ËüÖ±½Ó´ú±íÁËÒ»¸ö×Ö·û´®ÒÔ¼°ÆäÔÚÎļþÖеÄλÖᢳöÏÖ´ÎÊýµÈÐÅÏ¢¡£ Óò£¨ Field £©ÊÇÒ»¸ö¹ØÁªµÄÔª×飬ÓÉÒ»¸öÓòÃûºÍÒ»¸öÓòÖµ×é³É£¬ÓòÃûÊÇÒ»¸ö×Ö´®£¬ÓòÖµÊÇÒ»¸öÏî
  • 49. Lucene Ë÷ÒýÎļþ½á¹¹×é³É Óò¼¯ºÏÓëÏºÏÖеÄÎļþ×é²ÉÓÃÁËÒ»ÖÖÀàËƵĴ洢°ì·¨£ºÒ»¸öСÐ͵ÄË÷ÒýÎļþ£¬ÔËÐÐʱÔØÈëÄڴ棻һ¸ö¶ÔÓ¦ÓÚË÷ÒýÎļþµÄʵ¼ÊÐÅÏ¢Îļþ£¬¿ÉÒÔ°´ÕÕË÷ÒýÖÐָʾµÄÆ«ÒÆÁ¿Ëæ»ú·ÃÎÊ£» Ë÷ÒýÎļþÓëÐÅÏ¢ÎļþÔڼǼµÄÅÅÁÐ˳ÐòÉÏ´æÔÚÒþʽµÄ¶ÔÓ¦¹Øϵ£¬¼´Ë÷ÒýÎļþÖа´ÕÕ¡°Ë÷ÒýÏî 1 ¡¢Ë÷ÒýÏî 2¡­¡± ÅÅÁУ¬ÔòÐÅÏ¢ÎļþÔòÒ²°´ÕÕ¡°ÐÅÏ¢Ïî 1 ¡¢ÐÅÏ¢Ïî 2¡­¡± ÅÅÁС£
  • 50. Ò»¹²ÓÐËĸöÎļþ£¨ .tii,?.tis,.frq,.prx £©ÓÃÀ´¼Ç¼ Term Ïà¹ØµÄÐÅÏ¢£º -- ÔÚ .tis ÎļþÖУ¬¶Ôÿ¸ö Term ¶¼ÓÐÒ»Ïî TermInfo, ¶øÇÒ TermInfo ÊǸù¾Ý×Öµä˳ÐòÅÅÐò¡£ TermInfo ÖмǼµÄÁË Term ±¾Éí£¬ÒÔ¼°Ò»Ð©ÒÔÔÚ .frq ºÍ .prx Öк͸à Term Ïà¹ØÏêϸµÄÖ¸Õë¡£ -- .tii ÊÇ¶Ô .tis µÄÒ»¸öË÷Òý£¬ÓÃÀ´¼ÓËÙ¶Ô Term µÄ²éÕÒ¡£ -- .frq Îļþ¼Ç¼ÁËÿ¸ö Term ³öÏÖµÄÎĵµºÅÒÔ¼°ÆäƵÂÊ£¬ -- .prx Îļþ¼Ç¼ÁËÿ¸ö Term ÔÚÿƪÎĵµÖгöÏÖµÄλÖÃÐÅÏ¢¡£
  • 51. Ë÷Òý´æ´¢³éÏó -- Ë÷Òý´æ·ÅλÖà ´ÅÅÌ ¨C FSDirectory ½«Ë÷Òý´æ·ÅÔÚÎļþϵͳÖУ¬ Lucene »á×Ô¶¯ÔÚÄÚ´æÖн¨Á¢»º´æ£¬È»ºóµ½Ò»¶¨Ê±ºò¾ÍдÈë´ÅÅÌ¡£ IndexWriter writer = new IndexWriter(FSDirectory.getDirectory(path, true), new StandardAnalyzer(), true); ÄÚ´æ ¨C RAMDirectory £¬Ëٶȿ죬·Ç³Ö¾Ã»¯£¨ÐéÄâ»úÍ˳ö£¬Ë÷Òý¶ªÊ§£©£¬Òò´ËÐèÒ»·½·¨½«ÄÚ´æÖеÄË÷ÒýתÈë´ÅÅÌ¡£ IndexWriter writer = new IndexWriter(RAMDirectory.getDirectory(), new StandardAnalyzer(), true);
  • 52. Ë÷ÒýºÏ²¢ Ë÷ÒýµÄ ºÏ²¢ £ºµ±¿ª·¢ÕßÔÚ²»Í¬µÄµØ·½´´½¨Ðí¶àË÷Òý£¬Ä³ÖÖÇé¿öÏ£¬Ðè½øÐкϲ¢¡£ public void addIndexes(Directory[] dirs ) £¬ ¿ÉÒԺϲ¢ FSDirecotry ºÍ RAMDirectory £¬Ò²¿ÉÒԺϲ¢Á½¸ö FSDirectory ramWriter.addDocument(doc1); fsWriter.addDocument(doc2); ramWriter.close();// Ë÷Òý´´½¨Íê±Ï£¬¹Ø±ÕÄÚ´æËùÒýÆ÷£¬Ê¹ËùÓÐÎĵµ½øÈëÄÚ´æË÷ÒýÎļþ fsWriter.addIndexes(new Directory[]{fsDir}); fsWriter.close(); ɾ³ýÎĵµ¸ñʽ£ºÉ¾³ýÌض¨Îĵµ¡¢°´ Field À´É¾³ý IndexReader deleteDocuments(int docNum) , undeleteAll() deleteDocuments(Term term)
  • 53. Lucene Ë÷ÒýÓÅ»¯¡¢Í¬²½»úÖÆ optimize() £ºÍ¨¹ýÓÅ»¯¿ÉÒÔ¼õÉÙÒ»¸öËÑË÷Æ÷Ҫͬʱ´ò¿ªµÄÎļþÊý£¬½µµÍ I/O ¡£ ½«´ÅÅÌÉ϶à¸ö Segment ½øÐкϲ¢£¬×é³ÉÒ»¸öÈ«Ð嵀 Segment £¬¶Ô´ÅÅÌ¿Õ¼äÐèÇó´ó£¬Ó¦ÔÚ´óÅúÁ¿Ë÷Òý½¨Á¢Íê³ÉºóÔÙ½øÐе÷Óã¬×¢ÒâË÷ÒýÓÅ»¯ÖÜÆÚ¡£ ¶àÏ̻߳·¾³ÏµÄͬ²½»úÖÆ£¨Í¬²½·¨Ôò£©£º ÈκÎÊýÁ¿µÄÖ»¶Á²Ù×÷¿ÉÒÔ±»Í¬Ê±Ö´ÐУ¬ÈçʹÓà IndexSearcher ½øÐмìË÷ ÈκÎÊýÁ¿µÄÖ»¶Á²Ù×÷¶¼¿ÉÒÔÔÚË÷ÒýÕýÔÚ±»ÐÞ¸ÄʱִÐУ¬È磬ÍùË÷ÒýÖÐмÓÎĵµ¡¢É¾³ý¾ÉÎĵµ»òË÷ÒýÓÅ»¯¹ý³Ì ͬһʱ¼äÄÚ£¬Ö»¿ÉÒÔÓÐÒ»¸öÐÞ¸ÄË÷Òý²Ù×÷¡£ IndexWriter/IndexReader Lucene µÄË÷Òý¡°Ëø¡±£º Lucene ÉèÖÃÁË ÎļþËø £¬Ä¬ÈÏ·ÅÖÃÔÚϵͳÁÙʱÎļþ¼ÐÏ£¬¸ÃÎļþ¼Ð·¾­ÓÉ java.io.tempdir ϵͳ±äÁ¿Ö¸¶¨¡£ writer.lock £º·ÀÖ¹¶àÏß³ÌͬʱÐÞ¸ÄÒ»Ë÷ÒýÎļþ£¬ÓÉ IndexWriter ³õʼ»¯Ê±»ñµÃ£¬ÔڹرÕʱÊÍ·Å¡£ commit.lock £ºÔÚË÷ÒýµÄ Segment ±»½¨Á¢¡¢ºÏ²¢»ò¶ÁȡʱÉú³É¡£
  • 54. Lucene ËÑË÷ ËÑË÷µÄÁ÷³Ì ³õʼ»¯ IndexSearcher £º Searcher searcher = new IndexSearcher(indexDir); ¹¹½¨ Query £º Èç²éѯ·½Ê½£¨Ä£ºý²éѯ¡¢ÓïÒå²éѯ¡¢¶ÌÓï²éѯ¡¢·¶Î§²éѯ¡¢ ×éºÏ²éѯµÈ£© Query query = QueryParser.parse(queryString) ËÑË÷²¢´¦Àí·µ»Ø½á¹û £º Hits hits = searcher.search(query); ÅÅÐò¡¢¹ýÂË Web ¿ª·¢Ê±£¬½« Lucene ÓëÊý¾Ý¿âÏà½áºÏ£¬ÔÚË÷ÒýÖдæÈëһЩ¹Ø¼üµÄ ID ×ֶΡ¢Â·¾¶×ֶλòÊǼòµ¥µÄÎı¾£¬ÕæÕýµÄÊý¾ÝÌáÈ¡Ôò´ÓÊý¾Ý¿âÖеõ½¡£
  • 55. ¼ìË÷½á¹û -- Hits Lazy load result, LRU doubly-linked cache
  • 56. Lucene µÄÆÀ·Ö»úÖÆ ÆÀ·Ö»úÖƾÍÊǶԼìË÷½á¹û°´Ä³ÖÖ±ê×¼½øÐÐÆÀ¹À£¬È»ºó°´·ÖÖµµÄ¸ßµÍÀ´¶Ô½á¹û½øÐÐÅÅÐò¡£ ¶ÔÓÚÒ»¸öÉÌÓõÄËÑË÷ÒýÇæÀ´Ëµ£¬ÆÀ·Ö»úÖÆÊÇÆäÊÕÈëÀ´Ô´µÄÒ»²¿·Ö¡£ Lucene ÆÀ·ÖËã·¨£º£¨¼òµ¥Àí½â³Éij¸ö¹Ø¼ü×ÖÔÚÎĵµÖгöÏÖµÄƵÂÊ£© ¿ÉÒÔͨ¹ý Document µÄ setBoost(float boost) À´¸Ä±äÎĵµ boost Òò×Ó£¬½ø¶ø¸Ä±äÎĵµÆÀ·Ö
  • 57. ¹¹½¨ Query °´´ÊÌõËÑË÷ ¨C TermQuery Term term = new Term(¡°contents¡±, ¡°java¡±); Query query = new TermQuery(term); BooleanQuery public void add(BooleanClause clause) RangeQuery public RangeQuery(Term lowerTerm, Term upperTerm, boolean inclusive) PrefixQuery public PrefixQuery(Term prefix) ¶à¹Ø¼ü×ÖËÑË÷ -- PhraseQuery public void add(Term term) public void setSlop(int s) // Sets the number of other words permitted between words in //query phrase. If zero, then this is an exact phrase search. Ïà½ü´ÊÓïµÄËÑË÷ ¨C FuzzyQuery ͨÅä·ûËÑË÷ ¨C WildcardQuery // *, ? ¡­¡­ ½âÎöÓû§ÊäÈë×Ö·û´® -- QueryParser
  • 58. Lucene ·ÖÎöÆ÷ ¹ÜµÀ¹ýÂËÆ÷ģʽ £º·ÖÎöÆ÷ (Analyzer) ʹÓ÷ִÊÆ÷ (Tokenizer) ºÍ¹ýÂËÆ÷ (TokenFilter) ¹¹³ÉÒ»¸ö¹ÜµÀ£¬Îı¾ÔÚ¡°Á÷¹ý¡±Õâ¸ö¹ÜµÀºó£¬¾Í³ÉΪ¿ÉÒÔ½øÈëË÷ÒýµÄ×îСµ¥Ôª¡£ JavaCC Óë StandardAnalyzer(JavaCC Ϊ Lucene ¹¹½¨µÄ·ÖÎöÆ÷ ) TokenStream Tokenizer TokenFilter
  • 61. ¶ÔËÑË÷½á¹ûµÄÅÅÐò ÀýÈ磺 °Ñ²éѯ½á¹û°´ÕÕÀà±ð½øÐзÖ×é ÔÚ×éÄÚÔÙ°´ÕÕÓë²éѯµÄÏà¹Ø¶È½øÐÐÅÅÐò
  • 62. ËÑË÷ÒýÇæµÄÖÐÎÄÎÊÌâ ¶ÔÓÚÑÇÖÞÓïÑԵĵÄÇзִÊÎÊÌâ ¶ÔÓÚÖÐÎÄÀ´Ëµ£¬È«ÎÄË÷ÒýÊ×ÏÈ»¹Òª½â¾öÒ»¸öÓïÑÔ·ÖÎöµÄÎÊÌâ¡£Ó¢ÎÄÓï¾äÖе¥´ÊÖ®¼äÊÇÌìȻͨ¹ý¿Õ¸ñ·Ö¿ªµÄ£¬µ«ÑÇÖÞÓïÑÔµÄÖÐÈÕº«ÎÄÓï¾äÖеÄ×ÖÊÇÒ»¸ö×Ö°¤Ò»¸ö£¬ËùÓУ¬Ê×ÏÈÒª°ÑÓï¾äÖа´¡°´Ê¡±½øÐÐË÷ÒýµÄ»°£¬Õâ¸ö´ÊÈçºÎÇзֳöÀ´¾ÍÊÇÒ»¸öºÜ´óµÄÎÊÌâ¡£ Ê×ÏÈ£¬¿Ï¶¨²»ÄÜÓõ¥¸ö×Ö·û×÷ (si-gram) ΪË÷Òýµ¥Ôª£¬·ñÔò²é¡°ÉϺ£¡±Ê±£¬º¬ÓС°º£ÉÏ¡±Ò²ÄÜÆ¥Åä¡£ µ«Ò»¾ä»°£º¡°±±¾©Ìì°²ÃÅ¡±£¬¼ÆËã»úÈçºÎ°´ÕÕÖÐÎĵÄÓïÑÔÏ°¹ß½øÐÐÇзÖÄØ£¿ ¡°±±¾© Ìì°²ÃÅ¡± »¹ÊÇ¡°±± ¾© Ìì°²ÃÅ¡±£¿ÈüÆËã»úÄܹ»°´ÕÕÓïÑÔÏ°¹ß½øÐÐÇз֣¬ÍùÍùÐèÒª»úÆ÷ÓÐÒ»¸ö±È½Ï·á¸»µÄ´Ê¿â²ÅÄܹ»±È½Ï׼ȷµÄʶ±ð³öÓï¾äÖеĵ¥´Ê¡£ ÁíÍâÒ»¸ö½â¾öµÄ°ì·¨ÊDzÉÓÃ×Ô¶¯ÇзÖËã·¨£º½«µ¥´Ê°´ÕÕ 2 ÔªÓï·¨ (bigram) ·½Ê½ÇзֳöÀ´£¬±ÈÈ磺 ¡°±±¾©Ìì°²ÃÅ¡± ==> ¡° ±±¾© ¾©Ìì Ìì°² °²ÃÅ¡±¡£ ÕâÑù£¬ÔÚ²éѯµÄʱºò£¬ÎÞÂÛÊDzéѯ¡°±±¾©¡± »¹ÊDzéѯ¡°Ìì°²ÃÅ¡±£¬½«²éѯ´Ê×鰴ͬÑùµÄ¹æÔò½øÐÐÇз֣º¡°±±¾©¡±£¬¡°Ìì°²ÃÅ¡±£¬¶à¸ö¹Ø¼ü´ÊÖ®¼ä°´Óë¡° and¡± µÄ¹Øϵ×éºÏ£¬Í¬ÑùÄܹ»ÕýÈ·µØÓ³Éäµ½ÏàÓ¦µÄË÷ÒýÖС£ÕâÖÖ·½Ê½¶ÔÓÚÆäËûÑÇÖÞÓïÑÔ£ºº«ÎÄ£¬ÈÕÎĶ¼ÊÇͨÓõġ£ »ùÓÚ×Ô¶¯ÇзֵÄ×î´óÓŵãÊÇûÓдʱíά»¤³É±¾£¬ÊµÏÖ¼òµ¥£¬È±µãÊÇË÷ÒýЧÂʵ͡£
  • 63. ÖÐÎÄ·Ö´Ê lucene ×ÔÉíÌṩµÄ StandardAnalyzer ÒѾ­¾ß±¸ÖÐÎķִʵŦÄÜ£¬µ«ÊDz»Ò»¶¨Äܹ»Âú×ã´ó¶àÊýÓ¦ÓõÄÐèÒª¡£ ÁíÍâÎÒÃÇ̸µÄ±È½Ï¶àµÄÖÐÎÄ·Ö´ÊÆ÷»¹ÓУº CJKAnalyzer ¶þÔª·Ö´Ê ChineseAnalyzer »ù±¾µÈͬ StandardAnalyzer IK_CAnalyzer £¨ MIK_CAnalyzer £© »¹ÓÐһЩÍøÓÑ×Ô¼ºÐ´µÄ±È½Ï²»´íµÄ·Ö´ÊÆ÷ paoding £¬ÓÐÐËȤµÄ¿ÉÒÔ×Ô¼ºÑо¿Ñо¿¡£ CJKAnalyzer ºÍ ChineseAnalyzer ·Ö±ðÊÇ lucene-2.4.0 Ŀ¼Ï contrib Ŀ¼Ï lucene-analyzers-2.4.0 µÄ analyzers ÌṩµÄ¡£·Ö±ðλÓÚ cn ºÍ cjk Ŀ¼¡£ IK_CAnalyzer £¨ MIK_CAnalyzer £©ÊÇ»ùÓڷִʴʵ䣬Ŀǰ×îÐ嵀 1.4 °æ±¾ÊÇ»ùÓÚ lucene2.0 ¿ª·¢µÄ¡£ ÕýÏòÈ«ÇзִַÊÆ÷£º org.mira.lucene.analysis.IK_CAnalyzer £¨ÊʺϽ¨Ë÷ÒýʱʹÓã© ÕýÏò×î´óÈ«ÇзִַÊÆ÷£º org.mira.lucene.analysis.MIK_CAnalyzer £¨ÊʺÏÓû§ÊäÈë¼ìË÷ʱʹÓã©
  • 64. Óà lucene ºÍ Heritrix ¹¹½¨ÁËÒ»¸ö Web ËÑË÷Ó¦ÓóÌÐò Lucene ÊÇ»ùÓÚ Java µÄÈ«ÎÄÐÅÏ¢¼ìË÷°ü£¬ËüÄ¿Ç°ÊÇ Apache Jakarta ¼Ò×åÏÂÃæµÄÒ»¸ö¿ªÔ´ÏîÄ¿¡£ Lucene ºÜÇ¿´ó£¬µ«ÊÇ£¬ÎÞÂÛ¶àôǿ´óµÄËÑË÷ÒýÇ湤¾ß£¬ÔÚÆäºǫ́£¬¶¼ÐèÒªÒ»Ñù¶«Î÷À´Ö§Ô®Ëü£¬ÄǾÍÊÇÍøÂçÅÀ³æ Spider ¡£ÍøÂçÅÀ³æ Spider £¬»ò³ÆÍøÂç»úÆ÷ÈË¡¢ BOT µÈ£¬ÓÉÓÚÅÀ³æµÄ´æÔÚ£¬²ÅʹµÃËÑË÷ÒýÇæÓÐÁ˷ḻµÄ×ÊÔ´¡£ Heritrix ÊÇÒ»¸ö´¿ÓÉ Java ¿ª·¢µÄ¡¢¿ªÔ´µÄ Web ÍøÂçÅÀ³æ£¬Óû§¿ÉÒÔʹÓÃËü´ÓÍøÂçÉÏץȡÏëÒªµÄ×ÊÔ´¡£ËüÀ´×ÔÓÚ www.archive.org ¡£ Heritrix ×î³öÉ«Ö®´¦ÔÚÓÚËüµÄ¿ÉÀ©Õ¹ÐÔ£¬¿ª·¢Õß¿ÉÒÔÀ©Õ¹ËüµÄ¸÷¸ö×é¼þ£¬À´ÊµÏÖ×Ô¼ºµÄץȡÂß¼­¡£
  • 65. ϵͳ¼Ü¹¹ ÔÚÇ°¶ËÁ÷³ÌÖУ¬Óû§ÔÚËÑË÷ÒýÇæÌṩµÄ½çÃæÖÐÊäÈëÒªËÑË÷µÄ¹Ø¼ü´Ê£¬ÕâÀïÌáµ½µÄÓû§½çÃæÒ»°ãÊÇÒ»¸ö´øÓÐÊäÈë¿òµÄ Web Ò³Ã棬ȻºóÓ¦ÓóÌÐò½«ËÑË÷µÄ¹Ø¼ü´Ê½âÎö³ÉËÑË÷ÒýÇæ¿ÉÒÔÀí½âµÄÐÎʽ£¬²¢ÔÚË÷ÒýÎļþÉϽøÐÐËÑË÷²Ù×÷¡£ÔÚÅÅÐòºó£¬ËÑË÷ÒýÇæ·µ»ØËÑË÷½á¹û¸øÓû§¡£ÔÚºó¶ËÁ÷³ÌÖУ¬ÍøÂçÅÀ³æ´ÓÒòÌØÍøÉÏ»ñÈ¡ Web Ò³Ã棬ȻºóË÷Òý×Óϵͳ½âÎöÕâЩ Web Ò³Ãæ²¢´æÈëË÷ÒýÎļþÖС£
  • 66. DB È«ÎļìË÷ Mysql Sql server
  • 67. Hibernate Lucene Integration http://wiki.redsaga.com/confluence/display/HART/Hibernate+Lucene+Integration Lucene ʹÓÃÕßɳÁú http://blog.cnblog.org/archives/2005/07/luceneaecee.html