Lucene runs in eclipse

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.