- 浏览: 834928 次
文章分类
- 全部博客 (365)
- java (124)
- spring mvc (21)
- spring (22)
- struts2 (6)
- jquery (27)
- javascript (24)
- mybatis/ibatis (8)
- hibernate (7)
- compass (11)
- lucene (26)
- flex (0)
- actionscript (0)
- webservice (8)
- rabbitMQ/Socket (15)
- jsp/freemaker (5)
- 数据库 (27)
- 应用服务器 (21)
- Hadoop (1)
- PowerDesigner (3)
- EJB (0)
- JPA (0)
- PHP (2)
- C# (0)
- .NET (0)
- html (2)
- xml (5)
- android (7)
- flume (1)
- zookeeper (0)
- 证书加密 (2)
- maven (1)
- redis (2)
- cas (11)
最新评论
-
zuxianghuang:
通过pom上传报错 Artifact upload faile ...
nexus上传了jar包.通过maven引用当前jar,不能取得jar的依赖 -
流年末年:
百度网盘的挂了吧???
SSO单点登录系列3:cas-server端配置认证方式实践(数据源+自定义java类认证) -
953434367:
UfgovDBUtil 是什么类
Java发HTTP POST请求(内容为xml格式) -
smilease:
帮大忙了,非常感谢
freemaker自动生成源代码 -
syd505:
十分感谢作者无私的分享,仔细阅读后很多地方得以解惑。
Nginx 反向代理、负载均衡、页面缓存、URL重写及读写分离详解
lucene创建索引:
- import java.io.File;
- import java.io.IOException;
- import org.apache.lucene.analysis.Analyzer;
- import org.apache.lucene.analysis.standard.StandardAnalyzer;
- import org.apache.lucene.document.Document;
- import org.apache.lucene.document.Field;
- import org.apache.lucene.index.CorruptIndexException;
- import org.apache.lucene.index.IndexWriter;
- import org.apache.lucene.index.IndexWriterConfig;
- import org.apache.lucene.index.IndexWriterConfig.OpenMode;
- import org.apache.lucene.store.Directory;
- import org.apache.lucene.store.FSDirectory;
- import org.apache.lucene.store.LockObtainFailedException;
- import org.apache.lucene.util.Version;
- public class LuceneTest {
- String docsPath = null; //文件位置
- String indexPath =null; //索引位置
- public static void main(String[] args) {
- LuceneTest test = new LuceneTest();
- try {
- test.index();
- } catch (CorruptIndexException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (LockObtainFailedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- /**
- * 先创立索引
- * @throws IOException
- * @throws LockObtainFailedException
- * @throws CorruptIndexException
- */
- public void index() throws CorruptIndexException, LockObtainFailedException, IOException
- {
- docsPath=”F:\\Search engine\\搜索引擎\\lucene-3.1.0-src\\lucene-3.1.0\\contrib\\analyzers\\common\\readm.txt”;
- indexPath=”D:\\mywork\\LuceneTest\\lucenedic”;
- if(docsPath==null)
- {
- System.err.println(“docsPath为空”);
- System.exit(1);
- }
- File docDir = new File(docsPath);
- Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_31);
- Directory dir = FSDirectory.open(new File(indexPath));
- IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_31, analyzer);
- /*IndexWriter indexWriter1 = new IndexWriter(dir,new IndexWriterConfig(Version.LUCENE_31,
- new WhitespaceAnalyzer(Version.LUCENE_31)));*/
- iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
- IndexWriter indexWriter = new IndexWriter(dir,iwc);
- Document doc = new Document();
- Field pathField = new Field(“path”,docDir.getPath(),Field.Store.YES,Field.Index.NOT_ANALYZED_NO_NORMS);
- pathField.setOmitTermFreqAndPositions(true);
- doc.add(pathField);
- indexWriter.addDocument(doc);
- indexWriter.close();
- }
- }
发表评论
-
Solr4.0+IKAnalyzer中文分词安装
2012-11-29 19:14 1540有近2年没接触Solr跟Lucene ... -
solr搜索打分规制排序
2012-09-26 21:58 2362solr使用了Lucene的内核,也继承了Luce ... -
solr DataimportHanler
2012-09-22 17:01 1151大多数的应用程序将数据存储在关系数据库、xml文件 ... -
solr第一弹 autocomplete(自动补全)
2012-09-22 16:38 1423百度和google中都有 ... -
全文搜索服务器solr之客户端 - solrj二次开发
2012-09-21 09:07 4787Solrj已经是很强大的solr客户端了。它本身就包装了h ... -
Solr Data Import 快速入门
2012-09-20 14:32 808原文出处:http://blog.chenl ... -
JAVA环境下利用solrj二次开发SOlR搜索的环境部署常见错误
2012-09-20 11:36 1757问题一:出现控制台坏的响应错误一Bad reque ... -
Solr学习总结
2012-09-20 10:06 6405一、 SOLR搭建企业搜索平台 运行环境: 运行容器:Tomc ... -
olr 的客户端调用solrj 建索引+分页查询
2012-09-20 08:54 1888在 solr 3.5 配置及应用(一) 讲过一了 sol ... -
Solr笔记
2012-09-19 23:07 1253... -
Apache Solr 初级教程(介绍、安装部署、Java接口、中文分词)
2012-09-19 22:56 1725Apache Solr 介绍 Solr 是 ... -
lucene3.0 分页显示与高亮显示(转)
2012-09-19 11:44 1651分页类 Java代码 pac ... -
lucene3 中文IKAnalyzer分词例子
2012-09-10 13:37 1150import java.io.IOException; im ... -
Lucene3.0.1 学习笔记
2012-09-08 08:57 924不管怎么说,搜索都是非 ... -
Compass2.0.2自带例子解析
2012-09-05 08:47 1436Compass2.0.2自带例子解析: 下面的代码来自com ... -
compass站内搜索
2012-09-05 08:49 960compass站内搜索: 1.去官方网站下载compass的 ... -
Spring + Compass + paoding配置
2012-09-05 08:50 1022Spring + Compass + paoding配置: ... -
配置compass的索引位置为相对路径
2012-09-01 10:49 1323配置compass的索引位置为相对路径: Compass是对 ... -
Lucene demo调试运行:
2012-09-01 10:47 1988Lucene demo调试运行: 运行环境: JDK ... -
SSH + Lucene + 分页 + 排序 + 高亮 模拟简单新闻网站搜索引擎
2012-09-01 10:43 3418前两天看到了一个中国新闻网,这个网站的搜索form的a ...
相关推荐
Lucene创建索引步骤: 1、创建Directory(索引位置) 2、创建IndexWrite(写入索引) 3、创建Document对象 4、为Document添加Field(相当于添加属性:类似于表与字段的关系) 5、通过IndexWriter添加文档到索引中
Lucene3.0创建索引 读取目录下的所有txt文档格式的文件,然后生成一个索引文件到某目录下!
java创建Lucene索引
Lucene创建索引,查询索引的简单使用。
lucene索引结构原理
Lucene(这里用到的是Lucene.net版本也成为DotLucene)是一个信息检索的函数库(Library),利用它你可以为你的应用加上索引和搜索的功能. Lucene的使用者不需要深入了解有关全文检索的知识,仅仅学会使用库中的一个类,...
在Eclipse环境中运用java,Lucene建索引及查询关键字
1) 提供实时索引的创建、管理 2) Query的创建 详细介绍参照博客:http://blog.csdn.net/xiaojimanman/article/details/20624739 中的介绍
lucene并行索引
lucene创建索引,查询索引的简单使用。
为了快速查询,加快查询速度,减少与数据库交互,经常需要用到lucene实现创建索引和查询
通过lucene创建索引,然后进行各种搜索
lucene 创建索引和使用 快速入门的号东西
基于lucene5.3.1的项目实例 lucene创建索引,删除索引,更新索引,查找索引。
介绍了Lucene的基础知识,包括Lucene的历史和发展情况、使用Lucene创建索引和执行搜索的基本方法以及中文分词的应用,最后做了两个应用项目。第2部分:数据解析。介绍解析不同格式数据(如Word、PDF等)的方法,包括...
基于lucene技术的增量索引,实现索引的首次创建,动态增删改
lucene 对 xml建立索引 建立索引就是怎么简单 呵呵
Lucene创建与搜索索引。个人做的流程总结。
lucene 4.7.2支持java 6 ,之后的版本需要java 7以上,创建、删除、修改索引,搜索支持通用对象(可以根据对象类型搜索),可以范围搜索、排序、高亮,希望有所帮助
一步一步跟我学习lucene是对近期做lucene索引的总结,