Lucene 索引文件格式

索引架構(gòu)

lucene索引基本組成結(jié)構(gòu) index今膊、segment咙边、document、field拗胜、term

index:就是一個(gè)目錄

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

document:文檔怒允,可以在是一個(gè)網(wǎng)頁一個(gè)或者多個(gè)document構(gòu)成一個(gè)segment

field:類似數(shù)據(jù)庫中的字段埂软, 一個(gè)文檔包含多個(gè)field, 比如一個(gè)網(wǎng)頁包含:? 標(biāo)題、作者纫事、內(nèi)容勘畔。不同域的索引方式可以不一樣

term: 索引的最小單位,是經(jīng)過詞法分析和語言處理后的字符串

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:

名稱? ? ? ? ? ? ? ? ? ? ? ? ? ? 擴(kuò)展名? ? ? ? ? ? ? ? ? ? ? ? ? 說明

Segments Fil e? ?????????segments_N? ? ? ? ? ? ? ? ? 存儲檢查點(diǎn)

Lock File? ? ? ? ? ? ? ? ? ? ?write.lock? ? ? ? ? ? ? ? ? ? ? ?寫鎖儿礼,防止不同IndexWriter 寫同一個(gè)文件

Segment Info? ? ? ? ? ? ? .si? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?存儲段的meta信息

Compound File? ? ? ? ? ?.cfs,? .cfe? ? ? ? ? ? ? ? ? ? ? ? 種后綴的文件存在也可不存在咖杂,只有IndexWriter “優(yōu)化”過才會出現(xiàn)(將其他索引后綴文件合并庆寺,可以防止系統(tǒng)的文件句柄被消耗光)

? ?Fields????????????????????? .fnm? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 域文件蚊夫,存儲field的信息

Field Index? ? ? ? ? ? ? ? ?.fdx? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?指向 field data的指針

Field Data? ? ? ? ? ? ? ? ? ?.fdt? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?域數(shù)據(jù)文件:包含文檔中存儲的域

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

總結(jié)

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市懦尝,隨后出現(xiàn)的幾起案子知纷,更是在濱河造成了極大的恐慌,老刑警劉巖陵霉,帶你破解...
    沈念sama閱讀 222,946評論 6 518
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件琅轧,死亡現(xiàn)場離奇詭異,居然都是意外死亡踊挠,警方通過查閱死者的電腦和手機(jī)乍桂,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,336評論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來效床,“玉大人睹酌,你說我怎么就攤上這事∈L矗” “怎么了憋沿?”我有些...
    開封第一講書人閱讀 169,716評論 0 364
  • 文/不壞的土叔 我叫張陵,是天一觀的道長沪猴。 經(jīng)常有香客問我辐啄,道長采章,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,222評論 1 300
  • 正文 為了忘掉前任壶辜,我火速辦了婚禮悯舟,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘砸民。我一直安慰自己图谷,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,223評論 6 398
  • 文/花漫 我一把揭開白布阱洪。 她就那樣靜靜地躺著便贵,像睡著了一般。 火紅的嫁衣襯著肌膚如雪冗荸。 梳的紋絲不亂的頭發(fā)上承璃,一...
    開封第一講書人閱讀 52,807評論 1 314
  • 那天,我揣著相機(jī)與錄音蚌本,去河邊找鬼盔粹。 笑死,一個(gè)胖子當(dāng)著我的面吹牛程癌,可吹牛的內(nèi)容都是我干的舷嗡。 我是一名探鬼主播,決...
    沈念sama閱讀 41,235評論 3 424
  • 文/蒼蘭香墨 我猛地睜開眼嵌莉,長吁一口氣:“原來是場噩夢啊……” “哼进萄!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起锐峭,我...
    開封第一講書人閱讀 40,189評論 0 277
  • 序言:老撾萬榮一對情侶失蹤中鼠,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后沿癞,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體援雇,經(jīng)...
    沈念sama閱讀 46,712評論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,775評論 3 343
  • 正文 我和宋清朗相戀三年椎扬,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了惫搏。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,926評論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡蚕涤,死狀恐怖筐赔,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情钻趋,我是刑警寧澤川陆,帶...
    沈念sama閱讀 36,580評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響较沪,放射性物質(zhì)發(fā)生泄漏鳞绕。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,259評論 3 336
  • 文/蒙蒙 一尸曼、第九天 我趴在偏房一處隱蔽的房頂上張望们何。 院中可真熱鬧,春花似錦控轿、人聲如沸冤竹。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,750評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽鹦蠕。三九已至,卻和暖如春在抛,著一層夾襖步出監(jiān)牢的瞬間钟病,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,867評論 1 274
  • 我被黑心中介騙來泰國打工刚梭, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留肠阱,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,368評論 3 379
  • 正文 我出身青樓朴读,卻偏偏與公主長得像屹徘,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子衅金,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,930評論 2 361

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,352評論 0 10
  • |不斷前行 最重要的價(jià)值噪伊,并不在于“從何而來”,而在于“到哪里去”典挑。榮譽(yù)也出于此處酥宴。你的目標(biāo)是何種未來啦吧?你想跨過現(xiàn)...
    每日愛圖閱讀 198評論 0 0
  • 由柏拉圖提出 他說人在現(xiàn)實(shí)世界中生活您觉,好比戴著鐐銬的囚徒處在陰暗的洞穴中,背向洞口授滓,面對墻壁琳水,借助于背后的光,在墻...
    簡單木子閱讀 1,126評論 0 0
  • 下了課后般堆,離飯點(diǎn)還有段時(shí)間在孝。林青城和楊子隱在校園里晃悠了一圈,在小食街買了些吃的才回到817宿舍淮摔。一路過去都有人跟...
    我是林小花閱讀 6,211評論 0 1
  • 共享藝術(shù)來了造垛,你用了嗎? 藝品定制www.ypdingzhi.com 晰搀,可以自己開工作室五辽、店鋪、畫廊外恕,定制書畫杆逗、出...
    才哥全才閱讀 324評論 0 0