Lucene demo调试运行:

qiuzhuoxian 2012-09-01

Lucene demo调试运行:

运行环境:

  •  JDK 1.5
  •    TOMCAT 5.5
  •    Eclipse 3.0.1
  1. 解压lucene1.4.3
  2. 把luceneweb.war复制到tomcat的webapps目录,重新启动tomcat,就可以看到目录下多了一个luceneweb目录
  3. 新建一个index文件夹,位置不限,用来存放生成的索引文件。这里在D:/Tomcat5.5/webapps/luceneweb/index
  4. 在Eclipse下建立个工程,取名LuceneTest,并添加所需的jar包。Lucene-1.4.3.jar,lucene-demos-1.4.3.jar
  5. 把/lucene-1.4.3/src/demo/org/apache/lucene/demo目录下的类加到工程中,包结构可自定
  6. 运行IndexHtml.java 运行参数-create -index D:/Tomcat5.5/webapps/luceneweb/index D:/Tomcat5.5/webapps/luceneweb/docs 这个根据实际情况调整
  7. 一切没问题后,运行结果如下:adding D:/Tomcat5.5/webapps/luceneweb/docs/api/packages.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/api/serialized-form.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/benchmarks.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/contributions.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/demo.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/demo2.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/index.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/lucene-sandbox/index.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/lucene-sandbox/larm/overview.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/luceneplan.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/queryparsersyntax.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/resources.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/systemproperties.html

    addingD:/Tomcat5.5/webapps/luceneweb/docs/whoweare.html

    Optimizingindex…

    16644 total milliseconds
  8. 修改/luceneweb/下的configuration.jsp文件,String indexLocation = “/opt/lucene/index”;改为String indexLocation = “D://Tomcat5.5//webapps//luceneweb//index”;
  9. 重新启动tomcat,在浏览器中输入http://localhost:8080/luceneweb/,输入lucene查询一下
  10. 可以看到结果:

Welcome to the Lucene Template application. (This is the header)

DocumentSummary
Jakarta Lucene – Resources – Jakarta Lucene[Jakarta Lucene] About Overview Powered by Lucene Who We Are Mailing Lists Resources Wiki FAQ (Official) jGuru FAQ Getting Started Query Syntax System Properties File Formats Javadoc Contributions A
org.apache.lucene.analysis.de (Lucene 1.4.3 API)org.apache.lucene.analysis.de Classes  GermanAnalyzer GermanStemFilter GermanStemmer WordlistLoader
org.apache.lucene.document (Lucene 1.4.3 API)org.apache.lucene.document Classes  DateField Document Field

。。。。。。。。。。。

相关推荐

ReganHoo / 0评论 2016-07-31
qiuzhuoxian / 0评论 2016-07-31