Lucene在Eclipse下的部署
来源:互联网 发布:维戈 莫特森 知乎 编辑:程序博客网 时间:2024/06/08 10:30
转载出处:http://blog.csdn.net/ayi_5788/article/details/52121131
Tools required:
Apache lucene – Download Here (After downloading extract the files to the desktop)
JDK/JRE 7 – Download Here (Install)
Eclipse – Download Here
Apache Lucene: Lucene is a full text search library written in Java. Lucene allows users to embed search functionality into any application. Read more about lucene at their official website. You can get an idea of the basic concepts in lucene by visiting this website.
Procedure: So, what are we waiting for? Let’s start to use lucene with eclipse…
Step 1: Open eclipse IDE
Step 2: Create a Java project (File -> New -> java Project)
Step 3: Give a name for the project. I have given “LuceneDemo” as the project name. Then click on “Finish”.
Now your eclipse IDE would look something like shown below:
Step 4: Right click on the project (LuceneDemo) and select “Properties” as shown below:
Step 5: Click on “Java Build Path” on the left side and select “Add External JARs…” button on the right as shown below:
Step 6: This step is very important. In this step, we will be adding 4 JAR files to our project (LuceneDemo). Previously you have extracted lucene on to your desktop. The folder name will be lucene-4.4.0. Below I will be listing the paths to 4 JAR files that we will be adding to our project:
C:\Users\User\Desktop\lucene-4.4.0\queryparser\lucene-queryparser-4.4.0.jar
C:\Users\User\Desktop\lucene-4.4.0\analysis\common\lucene-analyzers-common-4.4.0.jar
C:\Users\User\Desktop\lucene-4.4.0\core\lucene-core-4.4.0.jar
C:\Users\User\Desktop\lucene-4.4.0\demo\lucene-demo-4.4.0.jar
My lucene folder (lucene-4.4.0) is stored at location C:\Users\User\Desktop. This path might vary on your systems.
After selecting and adding the 4 JAR files, the eclipse “Java Build Path” dialog box will look as shown below:
After adding the JAR files, click on the “OK” button as shown in the above figure.
Step 7: Again right click on the project and select “New” and select “Class” as shown below:
Step 8: Provide a name for your class. I provided the name as “LuceneTest”. We will write our java code in this file and run it. Refer the below picture to know where to write the class name. Click on “Finish” once you are done.
Step 9: Copy/Paste the code from below. You should have prior knowledge of core java to understand the code. The code is commented at appropriate places so that you can understand what is going on in the code.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
Step 10: Click on “Run” button as shown below:
Output: The keyword I was searching in the code is “teja”. You can see the output in the console window as shown below:
Final note: I hope this tutorial helped you to start up with apache lucene using eclipse. Things may not Go perfect for you. You might face some errors while performing the steps in this tutorial. You can feel free to contact me via email if you have any errors or you can comment here in this article.
- Lucene在Eclipse下的部署
- Lucene在Eclipse上的部署And Example
- lucene在eclipse下运行
- lucene在eclipse下运行
- lucene在eclipse下运行
- 在eclipse下部署maven
- Apache-ftpserver在eclipse下的部署和使用
- 在Eclipse下部署java项目时的问题
- NS2在eclipse下的部署以及调试
- 在Eclipse中初用lucene
- 在eclipse下自动部署项目
- 基于lucene搜索引擎Solr在tomcat上的部署(一)
- Lucene在linux操作系统上的部署及demo使用方法
- 在eclipse里部署了项目但是在tomcat的wapps目录下却找不到该部署的项目
- Tomcat 7.0在Eclipse下安装与部署(下)
- 在eclipse中建立lucene
- lucene 在eclipse 中运行
- 用Eclipse远程调试部署在Tomcat下的Web应用程序
- 关于怎么读取Maven项目resource目录下面的文件
- Android—(第三方百度地图)
- 编写自己的代码库(javascript常用实例的实现与封装)
- C语言文件操作 和 预编译命令
- css中left和margin-left的区别
- Lucene在Eclipse下的部署
- js前端实现模糊查询
- JavaScriptCore的坑? 可能,待研究(JSExportAs方式绑定的本地通信)
- Linux设备模型(7)_Class
- 日常学习之 std::pair
- WARN No appenders could be found for logger的解决方法
- 最大子矩阵和
- java数据格式转换
- PAT基础题 4-11 求自定类型元素序列的中位数