´«ÖDz¥¿ÍJAVAÅàѵ2010 4 29Lucene×ܽá
´«ÖDz¥¿ÍJAVAÅàѵ2010-4-29Lucene×ܽá
½ñÌìÐÄÇé²»´í£¬±±¾©µÄÌìÖÕÓÚ¶³öÁËÌ«ÑôÄÇ»¨¶ùÒ»°ãµÄÁ³µ°¶ù£¬ÐÄÇéÒ²²»ÓÉÒò´Ë¶øÉú³öϲÔã¬ÈË×ÜÊÇ»áÊÜ»·¾³µÄÓ°Ï죬ÏÂÎç»ØÀ´ÐÂÎÅÖÐÎÒ¿´µ½¹ã¶«ÄDZ߷¢ÉúµÄÊ£¬ÎÒÐÄÇé˵²»³öÀ´µÄ³ÁÖØ£¬ÎªÊ²Ã´ÕâЩÈ˲»ºÃºÃÕäϧÉú»îÄØ£¿ÎªÊ²Ã´ÒªÄÃÄÇЩÎÞ¹¼µÄСº¢×Ó³öÆø£¬°¦£¡
Éú»îÒÀȻҪ¼ÌÐø£¬Ñ§Ï°ÒÀ¾ÉÒª¼ÌÐø£¬¾ÍÏñÿÌ춼Ҫµ½×â·¿ÍâÃæµÄСµê´ò°×Ã×·¹ÁË£¬ËäȻζµÀ²»ÊǺܺ㬵«È´ÊDz»¿ÉȱÉÙµÄÒ»²¿·Ö£¬Éú»î±¾À´¾ÍÈç´Ë£¬ÎÒÇÞÊҵĸçÃÇÌìÌ춼³Ô°×ÂøÍ·£¬ÎҾͲ»Çå³þÁË£¬¸çÃÇ£¬ÄãΪʲô¾ÍÄÇôϲ»¶³ÔÄÇÂøÍ·£¬¸çÃÇȴ˵£¬ÎÒ³ÔÃ×·¹³ÔÁ˶Ç×ÓÍ´£¬ÕæÊÇЦµ¿ÁË´óÑÀÁË£¬ËûÒ»ÌìÈý¶Ù£¬¶Ù¶Ù³ÔÂøÍ·¡£¾ÍÏñÎÒÒ»ÌìÒª³ÔÈý´Î°×Ã×·¹Ò»Ñù£¬²»¹ÜÎÒÔõôŬÁ¦µÄÏëÈ¥³Ô¼¸¸öÂøÍ·£¬µ«ÎÒ·¢ÏÖ£¬ÎҸı䲻ÁË£¬ÎÒ¶àÄêÀ´ÐγɵÄÏ°¹ß£¬»¹ÊÇÃ×·¹ºÃ£¬¸çÃÇÈÏΪÂøÍ·ºÃ£¬ËÒ²¸Ä±ä²»ÁËË¡£
ÌÀÑô¹âÀÏʦ£¬ÎÒÖ»ÄÜ˵ÊÇÈËÈçÆäÃû£¬ÕæµÄÊǺÜÑô¹âµÄÒ»ÃûÀÏʦ¡£´ÓËûµÄÑù×ÓÀ´ÍƶϵĻ°£¬Ëû¾ø¶ÔÊÇÎÒÃÇѧУ×îÄêÇáµÄһλÀÏʦ£¬ºÍÎÒÃÇ°àµÄͬѧ²î²»¶à´ó£¬ÈËÈçÆäÃû£¬Ñô¹âÈ÷ÍÑ£¬ÉùÒôÈ´·Ç³£ÓдÅÐÔ£¬Èç¹ûÊÇÅ®Éú£¬¿ÉÒԺܿì¾Í±»ËûµÄÉùÒôÃÔסÁË¡£Lucene£¬È«ÎÄËÑË÷ÒýÇ棬ÎÒÒ»±éÓÖÒ»±éµÄÒ²ÔÚËÑË÷£¬×ܽá½ñÌìËùѧµÄ֪ʶµã£º
1.ʹÓÃLucene¾ÍÊÇҪʵÏÖÕ¾ÄÚËÑË÷£¬³£Óõķ½Ê½¾ÍÊÇ´ÓÊý¾Ý¿âÖиù¾ÝÊäÈëÄÚÈݽøÐÐËÑË÷£¬µ«ÊÇÕâÑùµÄËÙ¶ÈÊǷdz£µÄÂýµÄ¡£µ«ÊÇͨ¹ýLucene¾Í¿ÉÒÔ´ÓË÷Òý¿âÖпìËٵļìË÷Ïà¹ØµÄ£¬×îÖ÷ÒªµÄ¾ÍÊÇ·ûºÏÓû§ÒªÇóµÄÊý¾Ý¡£
2.ÎÒÃǵŤ×÷¾ÍÊÇ×÷ÓòÙ×÷Lucene ÌṩµÄAPI²Ù×÷Ë÷Òý¿âÖеÄÊý¾Ý£¬ÒÔ¼°Î¬»¤ÆäÖеÄÊý¾Ý¡£
Ë÷Òý¿â¹ÜÀí£¬Ê¹ÓÃIndexWriter¡£ÓÃËû¿ÉÒÔÔÚË÷Òý¿âÖÐÔö¼Ó¡¢É¾³ý¡¢¸üÐÂË÷ÒýÊý¾Ý£¬¶ÔÓ¦µÄ·½·¨Îª£ºaddDocument()¡¢deleteDocuments()¡¢updateDocument()¡£Ò²¿ÉÒÔ½øÐÐË÷Òý¿âµÄһЩÆäËûÓйصÄÐÞ¸ÄÓëÓÅ»¯µÄ²Ù×÷¡£
ÔÚË÷Òý¿âÖÐËÑË÷£¬Ê¹ÓÃIndexSearcher¡£¶ÔÓ¦µÄ·½·¨Îªsearch()¡£
¸ÅÄ
1.Directory Ë÷Òý¿â¡£ËùÓеÄÊý¾ÝÒ²ÊÇÒÔÎļþµÄÐÎʽ´æÔÚË÷Òý¿âÖУ¬ÆäʵË÷Òý¿âÒ²¾ÍÊÇÒ»¸öÎļþ¼Ð£¬ÆäÖд¢ÁËÐíÐí¶à¶àµÄÊý¾Ý¡£ÎÒÃDz»ÓÃÖ±½ÓÈ¥¸ÄÎļþÖеÄÊý¾Ý£¬ÊÇͨ¹ýºÍÒÀÀµÓÚLuceneÌṩµÄAPI£¬¾ÍÏñÎÒÃÇʹÓÃSQLÓï¾äÈ¥²Ù×÷Êý¾Ý¿âÒ»Ñù¡£
´´½¨Óï¾ä£ºDirectory d = FSDirectory.open(new File("./"));
2.Analyzer(·ÖÎö)
(·ÖÎöÆ÷),ÎÒ¶Ô·ÖÎöÆ÷µÄÀí½â²»ÊǺܺá£ÔÚ´´½¨¡¢Ð޸ġ¢É¾³ý¡¢²éѯʱ¶¼ÒªÓõ½£¬ÌرðÊÇÔÚÒ»¸öÏîÄ¿ÖУ¬Äã²ÉÓÃʲôÑùµÄ·ÖÎö½øÐÐÌí¼ÓDocument¾ÍÒª²ÉÓÃͬÑùµÄ·ÖÎöÆ÷½øÐÐÆäËüµÄ²Ù×÷¡£ÒýÓÃÒ»¶ÎÒ
Ïà¹ØÎĵµ£º
ÊÂʵÉÏÍøÂç±à³Ì¼òµ¥µÄÀí½â¾ÍÊÇÁ½Ì¨¼ÆËã»úÏ໥ͨѶÊý¾Ý¶øÒÑ¡£¶ÔÓÚ³ÌÐòÔ±¶øÑÔ£¬È¥ÕÆÎÕÒ»ÖÖ±à³Ì½Ó¿Ú²¢Ê¹ÓÃÒ»ÖÖ±à³ÌÄ£ÐÍÏà¶Ô¾Í»áÏԵüòµ¥µÄ¶àÁË¡£Java SDKÌṩһЩÏà¶Ô¼òµ¥µÄApiÀ´Íê³ÉÕâЩ¹¤×÷£¬Socket¾ÍÊÇÆäÖÐÖ®Ò»¡£
¶ÔÓÚJava¶øÑÔ¡£ÕâЩApi´æÔÚÓëJava.netÕâ¸ö°üÀïÃæ¡£Òò´ËÖ»Òªµ¼ÈëÕâ¸ö°ü¾Í¿ÉÒÔ×¼±¸ÍøÂç±à³ÌÁË¡£ÍøÂç± ......
ºËÐÄÌáʾ£º±¾ÎÄÃèÊöÁËÔÚJ2meÖпª·¢Ö÷ҪʹÓõÄÍøÂçÁ¬½Ó·½·¨£¬·Ö±ðÏêϸ½éÉÜÁËʹÓÃhttpºÍsocketÁ½ÖÖ·½·¨¡£ HttpConnection Ê×ÏÈÎÒÃÇÏÈÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó°É£º Ö÷ÒªÓõ½µÄjava°ü£º javax.microedition.io.*; public String requestGET(String URLString,String URL) throws
±¾ÎÄÃèÊöÁËÔÚJ2meÖпª·¢Ö÷ҪʹÓõÄÍøÂçÁ¬½Ó·½·¨£¬ ......
Java iText ¶¯Ì¬ Éú³É PDF Îĵµ ±í¸ñ ÖÐÎÄÎÊÌâ
iTextÊÇÒ»¸ö¿ª·¢Ô´´úÂëµÄÏîÄ¿£¬Äã¿ÉÒÔʹÓÃiText·½±ãµÄʵÏÖPDFµÄÊä³ö¡£
Ò»¡¢iTextµÄÏÂÔØ£º
Äã¿ÉÒÔÔÚ http://www.lowagie.com/iText/ ²é¿´¹ØÓÚiTextµÄÏà¹ØÐÅÏ¢£¬°üÀ¨Ô´´úÂ룬Îĵµ..
1. itext-src-1.4 ......
´ó¶àÊýÈËÈÏΪ£¬½Ó¿ÚµÄÒâÒåÔÚÓÚ¶¥Ìæ¶àÖؼ̳С£ÖÚËùÖÜÖªJavaûÓÐc++ÄÇÑù¶àÖؼ̳еĻúÖÆ£¬µ«ÊÇÈ´Äܹ»Êµ×÷¶à¸ö½Ó¿Ú¡£ÆäʵÕâÑù×öÊǺÜǣǿµÄ£¬½Ó¿ÚºÍ¼Ì³ÐÊÇÍêÈ«²»Í¬µÄ¶«Î÷£¬½Ó¿ÚûÓÐÄÜÁ¦´úÌæ¶àÖؼ̳У¬Ò²Ã»ÓÐÕâ¸öÒåÎñ¡£½Ó¿ÚµÄ×÷Óã¬Ò»ÑÔÒÔ±ÎÖ®£¬¾ÍÊDZêÖ¾ÀàµÄÀà±ð£¨type of class£©¡£°Ñ²»Í¬ÀàÐ͵ÄÀà¹éÓÚ²»Í¬µÄ½Ó¿Ú£¬¿ÉÒÔ¸üºÃµÄ¹ÜÀí ......
package cn.com;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class Base64Test
{
public static void main(String[ ......