lucene 4.x中如何只存储不做索引
来源:互联网 发布:淘宝怎么提高人气 编辑:程序博客网 时间:2024/05/16 16:52
在3.x的版本中可以用new Field("id",map.get("ID").toString(),Store.YES,Index.NOT_ANALYZED)来让lucene做索引,只存储。在4.x中,要只做存储不做索引,可以这样
FieldType testType = new FieldType(); testType.setIndexed(false); testType.setStored(true); Field test = new Field("asdf", "asdfasf", testType); document.add(test);如果用这个
IntField test = new IntField(FEILD_ID, app.getAppId(), Field.Store.YES); test.fieldType().setIndexed(false); document.add(test);会报 this FieldType is already frozen and cannot be changed 这个错误,
XXXXField在定义的时候加了frozen参数,是禁止你修改那个变量的。
还有一种情况是,不做索引,也不分词,只存储。但是FieldType是默认分词,所以只能这样
FieldType testType = new FieldType(); testType.setIndexed(false);testType.setTokenized(false);testType.setStored(true); Field test = new Field("asdf", "asdfasf", testType); document.add(test);
- lucene 4.x中如何只存储不做索引
- 如何创建Lucene索引
- Lucene索引存储的优化
- 初学lucene之lucene4.x与lucene3.x控制索引域和存储域的方式对比
- Lucene如何实现增量索引?
- 如何读取Lucene索引数据
- lucene如何创建一个索引
- Lucene在结果中索引
- lucene.net索引文件存储简析
- solr索引如何存储
- Lucene 4.X 倒排索引原理与实现: (1) 词典的设计
- Lucene 4.X 倒排索引原理与实现: (2) 倒排表的格式设计
- Lucene搜索时,索引如何reopen
- 如何提高和优化Lucene索引速度
- 如何加快Lucene 索引的构建?
- Lucene初探之如何创建索引
- Lucene初探之如何创建索引
- Lucene初探之如何创建索引
- spring 注解1
- [Cocoa]深入浅出 Cocoa 之 Core Data(2)- 手动编写代码
- 数据结构
- Android 检测版本更新
- 说说C++中的INL文件
- lucene 4.x中如何只存储不做索引
- Oracle 12c 新特性之 Multitenant Architecture (四)
- 块介质恢复
- 在Android开发中使用Ant 一:环境的搭建及入门
- liferay6.1sdk目录认识
- Hadoop的那些事儿
- error C2871: “System”: 具有该名称的命名空间不存在
- Cocoa 怎样重新启动app (application relaunching)
- Lesson 8 Examination