[Lucene Series note 1]lucene6 installation and configuration (Windows system)

Source: Internet
Author: User

Lucene is a Java open source efficient full-text retrieval toolkit, which is used recently for projects to record the learning process.

First step: Download and install the JDK

1. First download the JDK from the official website (before downloading, check your computer is how many operating systems, if it is 32 download 32, if it is 64-bit download 64-bit, otherwise not compatible). After downloading to the current folder, double-click on the installation of the JDK executable file, follow the steps and tips, always click "Next" to complete the installation, here is assumed to install to the target file C:\Program files\java\jdk1.8.0_25;

2.JDK after the installation is complete, you need to manually configure the environment variables, right-click "My Computer", select "Properties" in the menu-"Advanced system Settings"--"advanced", and then click the "Environment Variables" button, pop up the window as shown below.

3. Select the "New" button, the value of the new Java_home variable is: C:\ProgramFiles\Java\jdk1.8.0_25, "OK" to save the variable;

4. Locate the "Path" variable in the list of system variables, select the "Edit" button, and add the value after the variable in the popup window, "C:\Program files\java\jdk1.8.0_25\bin;", be sure to note the semicolon ";" be indispensable;

5. Following the above steps, the JDK is basically successfully installed on the system and the development environment is already available.

Start menu-run, enter the "javac" command, if you can pop up the information window, the installation is successful.

Step two: Download the configuration Lucene (this assumes the download is 6.2.1)

Note: The variable values for lucene4.0 previous version classpath are different, please refer to the other tutorials

1. Download Lucene-6.2.1. Unzip to the current folder in the C drive.

2. Copy the Lucene-core-6.2.1.jar and Lucene-demo-6.2.1.jar in lucene-6.2.1 to the Lib directory of the JDK directory: C:\Program files\java\jdk1.8.0 _25\lib.

3. Set Classpath

The variable values to set classpath in the user variables and system variables are:

.; %java_home%\lib\lucene-demo-6.2.1.jar;%java_home%\lib\lucene-core-6.2.1.jar; C:\lucene-6.2.1\core\lucene-core-6.2.1.jar; C:\lucene-6.2.1\queryparser\lucene-queryparser-6.2.1.jar; C:\lucene-6.2.1\analysis\common\lucene-analyzers-common-6.2.1.jar; C:\lucene-6.2.1\demo\lucene-demo-6.2.1.jar;

Step Three: Run Demo

1. Create a Cc.txt text document in the lucene-6.2.1 folder, enter the Nihao in it, and save it.

2. Build the index, run cmd into the console, enter: Java org.apache.lucene.demo.indexfiles-docs C:\lucene-6.2.1

If all is right, you can see a bunch of console output, the index will be placed in an index folder, the index folder in your cmd current directory C:\Users\Administrator. (You can also build an index on a CD to another directory.)

3. Query index: Java org.apache.lucene.demo.SearchFiles

4. Enter "Nihao" to search for the cc.txt just now.

At this point, the installation configuration of Lucene is complete. The next article will record how to use it inside eclipse.

[Lucene Series note 1]lucene6 installation and configuration (Windows system)

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.