专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »编程综合 » lucene2.4.1:Lucene(2.4.1)技术研究(3)--Document源代码 »正文

lucene2.4.1:Lucene(2.4.1)技术研究(3)--Document源代码

来源: 发布时间:星期三, 2009年4月1日 浏览:3次 评论:0
1、Document文件

  Document是lucene自己定义种文件格式lucene使用docement来代替对应物理文件或者保存在数据库中数据因此Document只能作为数据源在Lucene中数据存贮种文件形式

  Document只是负责收集数据源区别文件可以构建同个Document只要用户将区别文件创建成Document类型文件Lucene就能快速找到查找并且使用他们



  对于个Document文件可以同时增加多个FieldLucene中对于每个数据源是使用Field类来表示多个Field组成个Document多个Document组成个索引文件Document和Field关系如果所示

 



Lucene(2.4.1)技术研究(3)--Document源代码

  图片看不清楚?请点击这里查看原图(大图)













  此时我们去看看Document这个类源代码Document采用默认不带参数构造但是我们他在创建时间

  产生两个变量:fields和 boost

  其中fields是创建了.gif' />List,其主要是保存Field类

  Boost主要是设置该doc优先级

  其思路方法:add(Fieldable field)增加个field对象

   removeField(String name)  根据name移除个ield对象(找到个就返回)

  removeFields(String name)  根据name移除所有field对象

  Field getField(String name)  根据名字找到该Field对象

  Fieldable getFieldable(String name)  根据名字找到Fieldable子类(Fieldable是 接口具体有Filed来实现)

  String get(String name) 根据名字找到给Filed对象中包含内容

  public final  getBinaryValue(String name) 主要查找Doc中包含有 2进制field 数据(如果不存在则返回null)

  public final List getFields 直接返回该Doc中包含Field

  系列文章:

  Lucene(2.4.1)技术研究(1)--lucene技术

  Lucene(2.4.1)技术研究(2)--分析事例

  Lucene(2.4.1)技术研究(4)--Field源代码

0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: