Yesterday, we tested the Lucene demo in cmd. Today we have successfully run it on Eclipse, so that we can debug it later.
It is much more convenient.
1. First, decompress e-2.3.1.zip to any folder. My files are F:/Lucene. in this case, the required folder is F:/Lucene/contrib, F:/Lucene/src. make sure that the two are not taken into account after they exist.
2. Create a project file-new -- javaproject in eclipse
Enter Project name: Lucene: In contents, select creating project from existing source and select the file location: F:/Lucene; after you click "Next", eclipse will automatically upload the folder to the Java package format. If not, you need to build your own package and then set it. all java files are imported into the package. The referenced class library is automatically imported.
3.enter any English in a new TXT text file (Chinese is not supported currently) in the testfolder created on the fdrive ). Right-click the indexfiles. Java package of org. Apache. Lucene. Demo under Src-demo and choose run as --- Open Run dialog.
In the displayed dialog box, select indexfiles on the left.
Enter the location of the .txt folder in argumentson the right.
Click Run. The completion information is displayed on the console, and the index folder is generated under F:/Lucene.
4. Then, you can directly run searchfiles. java. In org. Apache. Lucene. Demo. The console will allow you to enter the content to be queried. after entering the information, press enter to display the result.
Note: before re-running inderfiles. Java, delete the index folder generated under F:/Lucene.