Lucene1.4.3 Trial

xiaoxiao2021-03-06  49

Lucene is a very good full-text search system, in fact, I have been from the release technology network before I have been.

http://www.frontfree.net) I know this system, but I haven't tried it until a few days a few days have to help him debug Weblucene. I decided to try Lucene.

The reason why Lucene is not bad because it has many advantages compared to the database search system. The specific advantages You can refer to the car Dong's article: "Add a full-text search function in the application - Introduction to Java-based full-text index engine lucene (

http://www.chedong.com/tech/lucene.html ".

Test System Configuration: WinXP Professional SP1 Java JDK1.4.2 Resin3.0.9

First, establish an application environment

1. Copy the file luceneweb.war into your resin3.0.9 / webapps directory, start RESIN, run IE (

HTTP: // localhost: 8080 /), the system will automatically generate a directory called LuceneWeb.

2, add Lucene-1.3-final.jar, Lucene-Demos-1.3-Final.jar to the classpath in the system configuration.

3, establish an index file:

First create a directory DEST. This directory is an object you want to retrieve, you can contain subdirectory, and put the file you want to index into this directory (note that you can only index .html, .htm, .txt three file formats Other formats need you to modify itself).

Then create a directory LuceneIndex, and this directory stores the established index file.

Run CMD, enter your LuceneIndex directory, run as follows:

C: /RESIN-3.0.9/Webapps/luceneweb/luceneindex> java org.apache.lucene.Demo.indexhtml -create -index c: /resin-2.1.6/webapps/luceneIndex ../DEST

At this point, you will generate three files in your LuceneIndex directory, and the index file is established.

4, modify the configuration.jsp file:

Will string indexlocation = "/ opt / lucene / index"; modify the directory where your index file is located. Such as:

String indexlocation = "c: //RESIN-3.0.9/Webapps//luceneweb//luceneindex";

5, everything has been completed, enjoy it!

Test results map:

Note: 1. I also tested on Tomcat 4.0, but the support of Chinese is really too bad, and RESIN is really good for Chinese support.

2, Lucene does not have real-time, which is a defect that it needs to be manually established, and of course we can use threads to automatically establish and update an index every other time in a web application, so it can be improved.

转载请注明原文地址:https://www.9cbs.com/read-81989.html

New Post(0)