JavaScript must be enabled in order for you to view this page. However, it seems JavaScript is either disabled or not supported by your browser. To view this page, enable JavaScript by changing your browser options, then Try again! .

Lucene Compound Files

by solo L2007-07-27T17:15:00Z,tag:Lucene

注意:这里描述的是Lucene 2.1的Compound Files。如果您正在使用其它版本的Lucene最好参考一下该发行版的docs/fileformats.html文件。

Compound File是一个简单的容器,可以包含*.fnm,*.frq,*.prx,*.fdx,*.fdt,*.tii,*.tis,*.nrm等文件,但是不包含*.del文件。

Compound File的定义为:

Compound (.cfs) --> FileCount, <DataOffset, FileName> FileCount , FileData FileCount

FileCount --> VInt

DataOffset --> Long

FileName --> String

FileData --> raw file data,指上面FileName所对应的文件的内容。

让我们结合一个示例来看看这个定义,其中VInt,Long,String的定义可以查阅之前提到的docs/fileformats.html文件。这个示例使用了一个名为_2yl.cfs的真实文件,以十六进制打开,由于内容过长所以省略了那些没有意义的数据。

文件的开始是FileCount,以红色矩形框表示,值为0x08,表明这里有8个<DataOffset, FileName> 和8个FileData。

DataOffset以绿色矩形框表示,共64位,长度固定;FileName以桔红色矩形框表示,长度不定,细节可以参考String的定义。这里共有8对<DataOffset, FileName>,分别对应着_2yl.fnm,_2yl.frq,_2yl.prx,_2yl.fdx,_2yl.fdt,_2yl.tii,_2yl.tis,_2yl.nrm8个文件和它们内容的偏移量。

图中右边的数字N表示第N个DataOffset对应的内容的开始所在的行,开始位置由蓝色粗下划线标出。

Lucene Compound Files
Copyright © SoloL.org 冀ICP备06003230号