另外一种导入方法,直接导入开发版本即可:
https://lucene.apache.org/core/developer.html
在网上搜了几个都是过时的讲述,还是从google上找到了一个邮件,虽然写的很简陋但是真的好使了。
步骤很简单:
1. 下载 lucence 源码:
https://lucene.apache.org/core/index.html
点击下载,在点击对应的镜像url之后会看到类似ftp的东西,选择对应的源码。例如我选择的是:
http://mirrors.cnnic.cn/apache/lucene/java/5.1.0/
之后解压。
2. 打开eclipse,创建一个普通的java工程,里面是空的,只有src空目录。
3. 右击 src,选择import, 选择 General-->File System 然后点击对话框下面的Next。进入另外一个对话框,在这个选择框里选择 刚才解压的目录,然后选择 core/src/java 这个目录。然后点击对话框最下面的Finish即可。这时候顺利的话就会成功导入了。
4. 好,那么然后呢?
我在导入的时候看到有部分有红色的叉,仔细看是说不支持jre 1.7之下的环境,需要切换成jre1.7环境,由于已经装了jre1.7 ,由于eclipse 创建项目时默认是低版本的,所以有这个问题,点击他的提示之后就自动修复好了。至此,lucence core就导入完事了。
那么,问题来了,lucence还有许多文件我还没导啊,原来解压的那个文件夹下面有一堆的文件夹呢。
别急,看完core之后就可以一个个使用类似方法导入一点点看了。
在core/src/java下有一个overview.html 可以看到:
The Lucene API is divided into several packages:
- {@link org.apache.lucene.analysis} defines an abstract {@link org.apache.lucene.analysis.Analyzer Analyzer} API for converting text from a {@link java.io.Reader} into a {@link org.apache.lucene.analysis.TokenStream TokenStream}, an enumeration of token {@link org.apache.lucene.util.Attribute Attribute}s. A TokenStream can be composed by applying {@link org.apache.lucene.analysis.TokenFilter TokenFilter}s to the output of a {@link org.apache.lucene.analysis.Tokenizer Tokenizer}. Tokenizers and TokenFilters are strung together and applied with an {@link org.apache.lucene.analysis.Analyzer Analyzer}. analyzers-common provides a number of Analyzer implementations, including StopAnalyzer and the grammar-based StandardAnalyzer.
- {@link org.apache.lucene.codecs} provides an abstraction over the encoding and decoding of the inverted index structure, as well as different implementations that can be chosen depending upon application needs.
- {@link org.apache.lucene.document} provides a simple {@link org.apache.lucene.document.Document Document} class. A Document is simply a set of named {@link org.apache.lucene.document.Field Field}s, whose values may be strings or instances of {@link java.io.Reader}.
- {@link org.apache.lucene.index} provides two primary classes: {@link org.apache.lucene.index.IndexWriter IndexWriter}, which creates and adds documents to indices; and {@link org.apache.lucene.index.IndexReader}, which accesses the data in the index.
- {@link org.apache.lucene.search} provides data structures to represent queries (ie {@link org.apache.lucene.search.TermQuery TermQuery} for individual words, {@link org.apache.lucene.search.PhraseQuery PhraseQuery} for phrases, and {@link org.apache.lucene.search.BooleanQuery BooleanQuery} for boolean combinations of queries) and the {@link org.apache.lucene.search.IndexSearcher IndexSearcher} which turns queries into {@link org.apache.lucene.search.TopDocs TopDocs}. A number of QueryParsers are provided for producing query structures from strings or xml.
- {@link org.apache.lucene.store} defines an abstract class for storing persistent data, the {@link org.apache.lucene.store.Directory Directory}, which is a collection of named files written by an {@link org.apache.lucene.store.IndexOutput IndexOutput} and read by an {@link org.apache.lucene.store.IndexInput IndexInput}. Multiple implementations are provided, including {@link org.apache.lucene.store.FSDirectory FSDirectory}, which uses a file system directory to store files, and {@link org.apache.lucene.store.RAMDirectory RAMDirectory} which implements files as memory-resident data structures.
- {@link org.apache.lucene.util} contains a few handy data structures and util classes, ie {@link org.apache.lucene.util.FixedBitSet FixedBitSet} and {@link org.apache.lucene.util.PriorityQueue PriorityQueue}.
相关推荐
lucene3源码分析
lucene 2.4.1源码在eclipse调试运行通过
lucene3.0.3源码和教程
Lucene是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎。该资源是Lucene的完整源码,利用源码,可以定制适合自身需要的搜索引擎。
lucene是一个java编写的开源全文检索工具包,功能强大。您可以基于lucene编写自己的搜索引擎。
从官网上找的最新lucene源码。里面demo经测试可以跑
Annotated Lucene 中文版 Lucene源码剖析 Annotated Lucene 中文版 Lucene源码剖析 Annotated Lucene 中文版 Lucene源码剖析
Lucene学习源码.rar
[HeyJava][传智播客]全文检索Lucene源码
此博文是对近期做lucene索引的总结, (lucene,solr,netty,hadoop),如蒙加入,不胜感激,大家共同探讨,本人争取每日一博,希望大家关注呦
lucene5.0源码包,里面有源码、帮助文档、API、架包
Lucene3.5全部源码,打包jar文件,可以直接打开查看源码,Lucene开发必备
lucene全文检索案例源码 lucene全文检索案例源码
lucene.net 2.9.1 源码,lucene.net 2.9.1最新dll
FileReaderAll函数用来从文件中读取字符串,默认编码为“GBK”。在创建完最重要的IndexWriter之后,就开始遍历需要索引的文件,构造对应的Document和Filed类,最终通过IndexWriter的addDocument函数开始索引。...
lucene 源码分析
lucene 华电项目 源码
孔浩老师lucene源码.zip
Lucene.net 搜索引擎 Lucene.net源码 Lucene.net中文文档; 好的东西需要分享