Lucene 学习 3 Field
来源:互联网 发布:j2ee设计开发编程指南 编辑:程序博客网 时间:2024/04/29 15:16
上一篇实现了最简单的 Helloworld ,这一篇将介绍很重要的一个类 Field。
作为创建索引的第一步,就是向 document 中添加 field。
如果你使用 SVN 的话,可以到 https://svn.apache.org/repos/asf/lucene/dev/trunk/lucene,把 lucene 的源码下载下来。
有源码在手,学习上多少有些帮助。
疑惑
Document doc = new Document(); doc.add(new StringField("path", file.getPath(), Field.Store.YES));
这是上篇中的一小段代码,StringField 的第三个参数是什么作用?
另外 StringField 又该在什么情况下使用呢? 有没有其他的 "Field" 呢?
StringField
/** A field that is indexed but not tokenized: the entire * String value is indexed as a single token. For example * this might be used for a 'country' field or an 'id' * field, or any field that you intend to use for sorting * or access through the field cache. */
这是源码中对 StringField 的介绍,几个关键点是:
被索引,不分词,完整的值会被保存下来,适合于国家或 id 这样的字段。
索引是为了被查询,所以一般都是索引的。
不被索引的 field 不能被查询,只能作为其他 field 的附属物,比如 url。
分词是指用分词器将文本文档分割成更小的单元,每个单元都可以被搜索。
与分词对应的,就是完整保留下整个值,对于 Id 或者国家名而言,分割之后毫无意义。
一篇很好的文章
http://blog.itpub.net/28624388/viewspace-766381/
0 0
- Lucene 学习 3 Field
- Lucene深入学习(5)Lucene的Document与Field
- lucene,Field.Index, Field.Store
- Lucene Field.Stror Field.Index
- Lucene中的Field
- Lucene的Field类型
- Lucene Field问题
- Lucene Field.Store解析
- lucene中Field简析
- lucene--Field.Store解析
- 一步一步跟我学习lucene(2)---lucene的各种Field及其排序
- Field.Text AND Field.Keyword in Lucene
- lucene中Field.Index,Field.Store
- lucene中Field.Index,Field.Store详解
- lucene中Field.Index,Field.Store详解
- 学习笔记14 Lucene.NET中Field.Index 和 Field.Store的几种属性的用法
- lucene中Field.Index, Field.Store,Field.TermVector详解
- lucene中Field.Index, Field.Store,Field.TermVector详解
- Android动画分类和区别
- Windows开发版本划分
- UBUNTU用户 无法进入系统
- css3实现特殊动画,支持手机
- 编程挑战高校俱乐部分配糖果答案
- Lucene 学习 3 Field
- Linux下matlab的安装
- C++ static
- openGL---shader的几个变量
- main_loop函数中两种循环方式介绍
- ip地址检查是否合法
- 【交互设计】什么是微交互
- Android实现获取验证码效果
- 设计模式之适配器模式