번역 출처 - https://github.com/mocobeta/lucene-postings-format
이 페이지는 Apache Lucene 의 기본 PostingsFormat
- 역 색인(인덱스)를 저수준 바이너리 형식으로 표현하여 한눈에 볼 수 있도록 고급사용자를 위해 작성되었습니다.
NOTE: 이 내용은 Lucene 릴리스 버전이 아닌 특정 개정판(커밋)과 관련이 있습니다. 비정기적으로 업데이트되며, 아주 미세한 부분도 생략되는 경우가 많습니다. 더 자세한 내용 및 최신 정보는 공식 문서 또는 소스 코드(후자가 가장 좋습니다)를 참조하십시오.
PostingsFormat
(즉, 역 인덱스) 은 대략 두 가지 구성 요소, 즉 용어사전(Term dictionary)과 해당 용어를 포함하는 문서들의 집합 (Posting list)으로 구성 됩니다.
term metadata 형식 (.tmd file).
+--------+-----------+------------+------------+-----+-----------------+----------------+--------+
| Header | NumFields | FieldStats | FieldStats | ... | TermIndexLength | TermDictLength | Footer |
+--------+-----------+------------+------------+-----+-----------------+----------------+--------+
|------- ( # of fields ) -------|
CodecHeader
)VInt
) : 인덱스의 모든 필드 수.Long
) : Term Index 전체 길이.Long
) : Term Dictionary 전체 길이.CodecFooter
)+-------------+----------+----------------+----------+-------------------+--
| FieldNumber | NumTerms | RootCodeLength | RootCode | SumTotalTermFreq? |
+-------------+----------+----------------+----------+-------------------+--
--+------------+----------+---------------+---------+---------------+---------+--
| SumDocFreq | DocCount | MinTermLength | MinTerm | MaxTermLength | MaxTerm |
--+------------+----------+---------------+---------+---------------+---------+--
--+--------------+-----------+-------------+
| IndexStartFP | FSTHeader | FSTMetadata |
--+--------------+-----------+-------------+
VInt
) : 필드 번호.VLong
) : 필드의 고유 용어 수.VInt
): RootCode의 길이 .Bytes
) : VLong
): TF(term frequencies)의 전체 합계 ; 문서 ID만 색인하는 경우 생략.VLong
) : 문서 빈도(DF)의 합계.VInt
) : 이 필드가 포함된 문서의 수.VInt
) : MinTerm의 길이.Bytes
): 이 필드에 포함된 최소(첫 번째) 용어.VInt
): MaxTerm의 길이.Bytes
): 이 필드에 포함된 최대(마지막) 용어.VLong
): 이 필드에 해당하는 Term Index에 대한 파일 포인터.CodecHeader
)term dictionary 형식. (.tim file)
+--------+-----------+-----------+-----------+-----+--------+
| Header | NodeBlock | NodeBlock | NodeBlock | ... | Footer |
+--------+-----------+-----------+-----------+-----+--------+
|------------ ( # of blocks ) ------------|
CodecHeader
)CodecFooter
)+-------------+--------------+--------+---------------------+---------------
| BlockHeader | SuffixLength | Suffix | SuffixLengthsLength | SuffixLengths
+-------------+--------------+--------+---------------------+---------------
--+-------------+-----------+-----------+-----------+-----
| StatsLength | TermStats | TermStats | TermStats | ...
--+-------------+-----------+-----------+-----------+-----
|------------- ( # of terms ) ------------
--+----------------+--------------+--------------+--------------+-----+
| MetadataLength | TermMetadata | TermMetadata | TermMetadata | ... |
--+----------------+--------------+--------------+--------------+-----+
--| |----------------- ( # of terms ) -----------------|
VInt
) : 블록 메타데이터 (예: 블록에 포함된 항목 수).VLong
) : Suffix의 길이.Bytes
): 블록에 포함된 모든 용어들을 결합한 접미사.VInt
) : SuffixLengths의 길이.Byte
) or Bytes
) : 블록에 포함된 모든 용어의 접미사 길이.VInt
) : TermStats의 전체 길이.VInt
) : TermMetadata의 전체 길이 .+-----------------+---------+----------------+
| SingletonCount? | DocFreq | TotalTermFreq? |
+-----------------+---------+----------------+
VInt
) : 용어 앞에 오는 싱글톤 용어의 수 (DF==1, TTF==1) .VInt
) : 용어의 문서 빈도.VLong
) : 용어의 전체 TF(term frequency); 문서 ID만 색인하는 경우 생략.TBD
Term index file 형식. (.tip file)
+--------+----------+----------+----------+-----+--------+
| Header | FSTIndex | FSTIndex | FSTIndex | ... | Footer |
+--------+----------+----------+----------+-----+--------+
|---------- ( # of fields ) -----------|
CodecHeader
)Bytes
) : 필드 당 바이너리 인코딩 된 FST 인덱스.CodecFooter
)Document and term frequencies file 형식. (.doc file)
+--------+------------------------+------------------------+-----+--------+
| Header | (TermFreqs, SkipData?) | (TermFreqs, SkipData?) | ... | Footer |
+--------+------------------------+------------------------+-----+--------+
|------------------- ( # of terms ) --------------------|
CodecHeader
)CodecFooter
)+-------------------------------+-------------------------------+-----
| (PackedDocDelta, PackedFreq?) | (PackedDocDelta, PackedFreq?) | ...
+-------------------------------+-------------------------------+-----
|------------------------- ( # of doc blocks ) -----------------------
--+-------------------+-------------------+-------------------+-----+
| (DocDelta, Freq?) | (DocDelta, Freq?) | (DocDelta, Freq?) | ... |
--+-------------------+-------------------+-------------------+-----+
--|------------------- (# of remaining docs ) ----------------------|
PackedInts
) : 블록 압축된 문서 ID의 델타.PackedInts
) : 블록 압축된 TF(term frequencies)의 델타. 용어 출현 위치를 색인하지 않을 때는 생략.VInt
) : 문서 ID의 델타.VInt
) : TF(term frequencies)의 델타; 문서 ID만 색인하는 경우 생략.+------------------------------+------------------------------+-----+-----------+
| (SkipLevelLength, SkipLevel) | (SkipLevelLength, SkipLevel) | ... | SkipDatum |
+------------------------------+------------------------------+-----+-----------+
|------------------- ( # of skip levels - 1 ) ----------------------|
+-----------+-------------------------------+-------------------------------+-----+
| SkipDatum | (SkipDatum, ChildSkipLevelFP) | (SkipDatum, ChildSkipLevelFP) | ... |
+-----------+-------------------------------+-------------------------------+-----+
|--- ( maximum number of skip level for the number of docs seen ) ----|
VLong
) : 하위 skip level data에 대한 파일 포인터.+--------------+----------------+-----------------+---------------------+---------------------+-----------------+--
| SkipDocDelta | SkipDocFPDelta | SkipPosFPDelta? | SkipPosBlockOffset? | SkipPayBlockLength? | SkipPayFPDelta? |
+--------------+----------------+-----------------+---------------------+---------------------+-----------------+--
--+--------------+--------+--------+--------+-----+
| ImpactLength | Impact | Impact | Impact | ... |
--+--------------+--------+--------+--------+-----+
|------- ( # of impacts ) -------|
VInt
) : 각 블록의 마지막 문서 ID의 델타.VLong
) : .doc 파일에 있는 각 블록의 파일 포인터.VLong
) : .pos 파일에 있는 각 관련 블록의 파일 포인터; 용어 출현 위치를 색인하지 않을 때는 생략.VInt
) : .pos 파일의 관련 블록 내부 오프셋 값; 용어 출현 위치를 색인하지 않을 때는 생략.VInt
) : .pay 파일에 있는 각 관련 블록의 페이로드 길이 합계; 용어 출현 위치를 색인하지 않을 때는 생략.VLong
) : .pay 파일의 각 관련 블록의 파일 포인터; 오프셋/페이로드가 인덱싱되지 않은 경우 생략.VInt
) : Impacts의 전체 길이 .+----------------------+-----------------------+
| CompetitiveFreqDelta | CompetitiveNormDelta? |
+----------------------+-----------------------+
VInt
)ZLong
)positions file 형식. (.pos file)
+--------+---------------+---------------+---------------+-----+--------+
| Header | TermPositions | TermPositions | TermPositions | ... | Footer |
+--------+---------------+---------------+---------------+-----+--------+
|------------------- ( # of terms ) ------------------|
CodecHeader
)CodecFooter
)+----------------+----------------+-----+------------------+------------------+-----+
| PackedPosDelta | PackedPosDelta | ... | ResidualPosDelta | ResidualPosDelta | ... |
+----------------+----------------+-----+------------------+------------------+-----+
|---------- ( # of pos blocks ) --------|------- ( # of remaining positions ) ------|
PackedInts
) : 블록 압축된 문서 ID의 델타.VInt
로 인코딩된 나머지 위치의 델타.+----------+----------------+----------+--------------+---------------+
| PosDelta | PayloadLength? | Payload? | OffsetDelta? | OffsetLength? |
+----------+----------------+----------+--------------+---------------+
VInt
) : delta 위치.VInt
) : Payload 길이; 페이로드가 색인되지 않은 경우 생략.Bytes
) : Payload 데이터; 페이로드가 색인되지 않은 경우 생략.VInt
) : 시작 오프셋 델타; 문자 오프셋이 색인되지 않은 경우 생략.VInt
) : offset 길이 (종료 문자 오프셋에서 시작 문자 오프셋을 뺀 것); 문자 오프셋이 색인되지 않은 경우 생략.payloads and offsets file 형식. (.pay file)
+--------+-------------------------------+------------------------------+-----+--------+
| Header | (TermPayloads?, TermOffsets?) | (TermPayloads?, TermOffsets) | ... | Footer |
+--------+-------------------------------+------------------------------+-----+--------+
|---------------------- ( # of terms ) ------------------------------|
CodecHeader
)CodecFooter
)+--------------------------------------------------------+--------------------------------------------------------+-----+
| (PackedPayloadLengths, SumPayloadLengths, PayloadData) | (PackedPayloadLengths, SumPayloadLengths, PayloadData) | ... |
+--------------------------------------------------------+--------------------------------------------------------+-----+
|------------------------------------------- ( # of pos blocks ) -------------------------------------------------------|
PackedInts
) : 블록 압축된 페이로드 길이.VInt
) : 이 블록의 페이로드 길이 합계.Bytes
) : 이 블록의 모든 페이로드를 결합한 데이터.+------------------------------------------+------------------------------------------+-----+
| (PackedOffsetDelta, PackedOffsetLengths) | (PackedOffsetDelta, PackedOffsetLengths) | ... |
+------------------------------------------+------------------------------------------+-----+
|----------------------------------- ( # of pos blocks ) -----------------------------------|
PackedInts
) : 블록 압축된 시작 문자 오프셋의 델타.PackedInts
) : 블록 압축된 문자 오프셋 길이(종료 문자 오프셋에서 시작 문자 오프셋을 뺀 것).