lucene-3.0.2 demo 入门

来源:互联网 发布:苹果手机视频录像软件 编辑:程序博客网 时间:2024/05/22 14:18

 


1.将lucene-3.0.2.rar解压, 将其中的luceneweb.war  copy到tomcat webapps目录中, 启动tomcat, 

  luceneweb.war自动解压文件夹为luceneweb.  在luceneweb下建立docs和index两个目录(其路径是可随意

  的,但暂时先定在这), 可将lucene-3.0.2文件夹下的docs拷贝过来,docs不能为空.

2.在MyEclipse中建立一个工程luceneTest, 将lucene-3.0.2里的lucene-demos-3.0.2.jar 和

  lucene-core-3.0.2.jar到工程下,将lucene-3.0.2下的src目录下的demos拷贝到luceneTest src下, 相应的

  类路径对应即可.

3.运行IndexHTML文件,参数为: -create -index

  D:/tomcat6/webapps/luceneweb/index D:/tomcat6/webapps/luceneweb/docs

  ,在控制台会看到如下的的打印信息, 同时在刚才建立和Index文件夹下会生成一些文件


....
adding D:/Tomcat6/webapps/luceneweb/docs/index.html
adding D:/Tomcat6/webapps/luceneweb/docs/linkmap.html
adding D:/Tomcat6/webapps/luceneweb/docs/lucene-contrib/index.html
adding D:/Tomcat6/webapps/luceneweb/docs/queryparsersyntax.html
adding D:/Tomcat6/webapps/luceneweb/docs/scoring.html
adding D:/Tomcat6/webapps/luceneweb/docs/skin/images/README.txt
adding D:/Tomcat6/webapps/luceneweb/docs/skin/note.txt
adding D:/Tomcat6/webapps/luceneweb/docs/systemrequirements.html
Optimizing index...
60188 total milliseconds
4. 将tomcat webapps luceneweb 下的configuration.jsp 的String indexLocation = "D://tomcat6//webapps//luceneweb//index"; 改成这样
5.启动tomcat, 在浏览器中运行http://localhost:8080/luceneweb/.  ,在浏览器中输入文本即可搜索,