Lucene 索引文件格式

索引架构

lucene索引基本组成结构 index、segment、document、field、term

index:就是一个目录

segment:段,一系列索引文件组成的抽象的该您

document:文档,可以在是一个网页一个或者多个document构成一个segment

field:类似数据库中的字段, 一个文档包含多个field, 比如一个网页包含:  标题、作者、内容。不同域的索引方式可以不一样

term: 索引的最小单位,是经过词法分析和语言处理后的字符串

Segment info. This contains metadata about a segment, such as the number of documents, what files it uses,

Field names. This contains the set of field names used in the index.

Stored Field values. This contains, for each document, a list of attribute-value pairs, where the attributes are field names. These are used to store auxiliary information about the document, such as its title, url, or an identifier to access a database. The set of stored fields are what is returned for each hit when searching. This is keyed by document number.

Term dictionary. A dictionary containing all of the terms used in all of the indexed fields of all of the documents. The dictionary also contains the number of documents which contain the term, and pointers to the term's frequency and proximity data.

Term Frequency data. For each term in the dictionary, the numbers of all the documents that contain that term, and the frequency of the term in that document, unless frequencies are omitted (IndexOptions.DOCS_ONLY)

Term Proximity data. For each term in the dictionary, the positions that the term occurs in each document. Note that this will not exist if all fields in all documents omit position data.

Normalization factors. For each field in each document, a value is stored that is multiplied into the score for hits on that field.

Term Vectors. For each field in each document, the term vector (sometimes called document vector) may be stored. A term vector consists of term text and term frequency. To add Term Vectors to your index see the Fieldconstructors

Per-document values. Like stored values, these are also keyed by document number, but are generally intended to be loaded into main memory for fast access. Whereas stored values are generally intended for summary results from searches, per-document values are useful for things like scoring factors.

Live documents. An optional file indicating which documents are live.

Point values. Optional pair of files, recording dimensionally indexed fields, to enable fast numeric range filtering and large numeric values like BigInteger and BigDecimal (1D) and geographic shape intersection (2D, 3D).

索引文件后缀和含义:

The following table summarizes the names and extensions of the files in Lucene:

名称                            扩展名                          说明

Segments Fil e           segments_N                  存储检查点

Lock File                     write.lock                       写锁,防止不同IndexWriter 写同一个文件

Segment Info              .si                                   存储段的meta信息

Compound File           .cfs,  .cfe                        种后缀的文件存在也可不存在,只有IndexWriter “优化”过才会出现(将其他索引后缀文件合并,可以防止系统的文件句柄被消耗光)

   Fields                      .fnm                                域文件,存储field的信息

Field Index                 .fdx                                 指向 field data的指针

Field Data                   .fdt                                 域数据文件:包含文档中存储的域

Term Dictionary          .tim                                The term dictionary, stores term info

Term Index                 .tip                                  The index into the Term Dictionary

Frequencies               .doc                                Contains the list of docs which contain each term along with                                                                                     frequency

Positions                     .pos                               Stores position information about where a term occurs in the                                                                             index

Payloads                     .pay                              Stores additional per-position metadata information such as                                                                                         character offsets and user payloads

Norms                        .nvd, .nvm                      Encodes length and boost factors for docs and fields

Per-Document Values    .dvd, .dvm                  Encodes additional scoring factors or other per-document                                                                                        information.

Term Vector Index            .tvx                            Stores offset into the document data file

Term Vector Data            .tvd                             Contains term vector data.

Live Documents            .livInfo                          about what documents are live

Point values                .dii, .dim                          Holds indexed points, if any

总结

Index –> Segments (segments.gen, segments_N) –> Field(fnm, fdx, fdt) –> Term (tvx, tvd, tvf)

参考:

https://lucene.apache.org/core/7_3_0/core/org/apache/lucene/codecs/lucene70/package-summary.html#package.description

https://blog.csdn.net/ghj1976/article/details/5586329

http://www.cnblogs.com/forfuture1978/archive/2009/12/14/1623599.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,544评论 6 501
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,430评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,764评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,193评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,216评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,182评论 1 299
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,063评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,917评论 0 274
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,329评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,543评论 2 332
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,722评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,425评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,019评论 3 326
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,671评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,825评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,729评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,614评论 2 353

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,322评论 0 10
  • |不断前行 最重要的价值,并不在于“从何而来”,而在于“到哪里去”。荣誉也出于此处。你的目标是何种未来?你想跨过现...
    每日爱图阅读 196评论 0 0
  • 由柏拉图提出 他说人在现实世界中生活,好比戴着镣铐的囚徒处在阴暗的洞穴中,背向洞口,面对墙壁,借助于背后的光,在墙...
    简单木子阅读 1,121评论 0 0
  • 下了课后,离饭点还有段时间。林青城和杨子隐在校园里晃悠了一圈,在小食街买了些吃的才回到817宿舍。一路过去都有人跟...
    我是林小花阅读 6,204评论 0 1
  • 共享艺术来了,你用了吗? 艺品定制www.ypdingzhi.com ,可以自己开工作室、店铺、画廊,定制书画、出...
    才哥全才阅读 324评论 0 0