课程二十二lucene4实战类搜索的大型海量系统课件04l索引深入_第1页
课程二十二lucene4实战类搜索的大型海量系统课件04l索引深入_第2页
课程二十二lucene4实战类搜索的大型海量系统课件04l索引深入_第3页
课程二十二lucene4实战类搜索的大型海量系统课件04l索引深入_第4页
课程二十二lucene4实战类搜索的大型海量系统课件04l索引深入_第5页
已阅读5页,还剩19页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、讲师:tom5(北风网版权所有)第四讲 Lucene索引深入生成的索引文件目录截图:Segments File(索引片段信息):文件后缀名:segments.gen, segments_N存储建立索引的任务信息,当前有效的索引文件索引中活动(active)的Segments被存储在segment info文件中,segments_N,在索引中可能会包含一个或多个segments_N文件。然而,最大一代的那个文件(the one with largest generation)是活动的片断文件(这时更旧的segments_N文件依然存在(are present)是因为它们暂时(temporari

2、ly)还不能被删除,或者,一个writer正在处理提交请求(in the process of committing),或者一个用户定义的(custom)IndexDeletionPolicy正被使用)。这个文件按照名称列举每一个片断(lists each segment by name),详细描述分离的标准(seperate norm)和要删除的文件(deletion files),并且还包含了每一个片断的大小。Lock File(锁文件):文件后缀名:write.lock写锁是为了防止多个IndexWriters 写同一个文件写锁(write lock)文件名为“write.lock”,它

3、缺省存储在索引目录中。如果锁目录(lock directory)与索引目录不一致,写锁将被命名为“XXXX-write.lock”,其中“XXXX”是一个唯一的前缀(unique prefix),来源于(derived from)索引目录的全路径(full path)。当这个写锁出现时,一个writer当前正在修改索引(添加或者清除文档)。这个写锁确保在一个时刻只有一个writer修改索引。Segment Info (索引片段信息 Lucene 4.0 Segment info format. ):文件后缀名:.si存储关于该索引片段的原数据metadata信息Lucene 4.0 索引片段信

4、息文件格式.Lucene 4的新尝试,可能不同其他版本兼容WARNING: This API is experimental and might change in incompatible ways in the next release.Fields (Lucene 4.2字段集合信息文件格式):文件后缀名:.fnm Field的名字都存储在Field信息文件中。查看样例代码:字段有:pathmodifiedcontentsField Index (field索引文件):文件后缀名:.fdx保存了每个Document的Field Data的地址指针。Lucene 4.1 stored fi

5、elds format.Field Data (Lucene 4.1 stored fields format.):文件后缀名:.fdt保存了每个Document的需要存储的Field数据。Term Dictionary:文件后缀名:.tim保存了term信息文件。样例截图:Lucene 4.1 postings format, which encodes postings in packed integer blocks for fast decode.NOTE: this format is still experimental and subject to change without

6、backwards compatibility.Term Index :文件后缀名:.tipterm的索引文件。样例截图:Lucene 4.1 postings format, which encodes postings in packed integer blocks for fast decode.NOTE: this format is still experimental and subject to change without backwards compatibility.Frequencies :文件后缀名:.doc包含了每一term的文档的列表,和该term在文档中出现的频

7、数 。样例截图:Lucene 4.1 postings format, which encodes postings in packed integer blocks for fast decode.NOTE: this format is still experimental and subject to change without backwards compatibility.Positions :文件后缀名:.pos保存了每个Term在Document中的位置集合。样例截图:Lucene 4.1 postings format, which encodes postings in p

8、acked integer blocks for fast decode.NOTE: this format is still experimental and subject to change without backwards compatibility.Payloads :文件后缀名:.pay存储额外的内容相关性评分的数据。Lucene 4.1 postings format, which encodes postings in packed integer blocks for fast decode.NOTE: this format is still experimental a

9、nd subject to change without backwards compatibility.Norms (Lucene 4.2 score normalization format.):文件后缀名: .nvd, .nvm评分数据的保存文件。NOTE: this uses the same format as Lucene42DocValuesFormat Numeric DocValues, but with different file extensions, and passing PackedInts.FASTEST for uncompressed encoding: t

10、rading off space for performance.在Lucene中score简单说是由 tf * idf * boost * lengthNorm计算得出的。 tf:是查询的词在文档中出现的次数的平方根 idf:表示反转文档频率,观察了一下所有的文档都一样,所以那就没什么用处,不会起什么决定作用。 boost:激励因子,可以通过setBoost方法设置,需要说明的通过field和doc都可以设置,所设置的值会同时起作用lengthNorm:是由搜索的field的长度决定了,越长文档的分值越低。 Per-Document Values ( Lucene 4.2 DocValues

11、 format.):文件后缀名: .dvd, .dvm 编码保存额外的评分因子及其他每文档的信息。Term Vector Index( Lucene 4.0 Term Vectors format.):文件后缀名: .tvx 保存文档中词term偏移位置的数据索引文件。主要针对 .tvd 及 .tvf 的 索引文件Term Vector Documents ( Lucene 4.0 Term Vectors format.):文件后缀名: .tvd每个包含Term Vectors 文档的信息Term Vector Fields ( Lucene 4.0 Term Vectors format.

12、):文件后缀名: .tvf同Term Vectors 相应的field的信息Deleted Documents ( Lucene 4.0 Live Documents Format ):文件后缀名: .del只有一个索引分片文件包含删除的文件时才有这个文件修改run命令 加入 update 参数 保证非每次新建索引删除一个文件1.txt再检索,查看是否生成了 _1_1.del 文件Compound File(索引片段信息 Lucene 4.0 Segment info format. ):文件后缀名:.cfs, .cfe 当采用复合文件建立索引时,所有索引文件会保存在一个.cfs文件内。修改代

13、码演示效果: TieredMergePolicy mergePolicy = new TieredMergePolicy(); iwc.setMergePolicy(mergePolicy.setNoCFSRatio(1.0d); If a merged segment will be more than this percentage of the total size of the index, leave the segment as non-compound file even if compound file is enabled. Set to 1.0 to always use

14、CFS regardless of merge size. Default is 0.1.Compound File(索引片段信息 Lucene 4.0 Segment info format. ):文件后缀名:.cfs, .cfe 当采用复合文件建立索引时,所有索引文件会保存在一个.cfs文件内。修改代码演示效果: TieredMergePolicy mergePolicy = new TieredMergePolicy(); iwc.setMergePolicy(mergePolicy.setNoCFSRatio(1.0d); If a merged segment will be mor

15、e than this percentage of the total size of the index, leave the segment as non-compound file even if compound file is enabled. Set to 1.0 to always use CFS regardless of merge size. Default is 0.1.Lucene的当前实现索引中使用Java语言中的 int 对term词典计数。所以单个索引片段文件中词典最大的数目为: 2.1 billion (约21亿)X 索引片段文件最大个数(128)故 能索引的词典最大数目为: 274 billion (约2740亿)这个限制不是索引文件格式造成的,是采用当前java实现版本造成的。(This is technically not a limitation of the index file format, just of Lucenes current implementation.)同理:也是使用int 对document文档源计数的。并且索引文件格式也是采用的

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论