blob: 0d6661c3b3efa3e5f4c4a5b678527eb89e3f3c6d [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Namespace Lucene.Net.Codecs.Lucene45
| Apache Lucene.NET 4.8.0-beta00013 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Namespace Lucene.Net.Codecs.Lucene45
| Apache Lucene.NET 4.8.0-beta00013 Documentation ">
<meta name="generator" content="docfx 2.56.2.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="core/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<span id="forkongithub"><a href="https://github.com/apache/lucenenet" target="_blank">Fork me on GitHub</a></span>
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Codecs.Lucene45">
<h1 id="Lucene_Net_Codecs_Lucene45" data-uid="Lucene.Net.Codecs.Lucene45" class="text-break">Namespace Lucene.Net.Codecs.Lucene45
</h1>
<div class="markdown level0 summary"><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<p>Lucene 4.5 file format.</p>
<h1 id="apache-lucene---index-file-formats">Apache Lucene - Index File Formats</h1>
<div>
* <a href="#introduction">Introduction</a>
* <a href="#definitions">Definitions</a>
* <a href="#inverted-indexing">Inverted Indexing</a>
* <a href="#types-of-fields">Types of Fields</a>
* <a href="#segments">Segments</a>
* <a href="#document-numbers">Document Numbers</a>
* <a href="#overview">Index Structure Overview</a>
* <a href="#file-naming">File Naming</a>
* <a href="#file-names">Summary of File Extensions</a>
* <a href="#lock-file">Lock File</a>
* <a href="#history">History</a>
* <a href="#limitations">Limitations</a>
</div>
<h2 id="introduction">Introduction</h2>
<div>
This document defines the index file formats used in this version of Lucene. If you are using a different version of Lucene, please consult the copy of <code>docs/</code> that was distributed with the version you are using.
Apache Lucene is written in Java, but several efforts are underway to write <a href="http://wiki.apache.org/lucene-java/LuceneImplementations">versions of Lucene in other programming languages</a>. If these versions are to remain compatible with Apache Lucene, then a language-independent definition of the Lucene index format is required. This document thus attempts to provide a complete and independent definition of the Apache Lucene file formats.
As Lucene evolves, this document should evolve. Versions of Lucene in different programming languages should endeavor to agree on file formats, and generate new versions of this document.
</div>
<h2 id="definitions">Definitions</h2>
<div>
The fundamental concepts in Lucene are index, document, field and term.
An index contains a sequence of documents.
* A document is a sequence of fields.
* A field is a named sequence of terms.
* A term is a sequence of bytes.
The same sequence of bytes in two different fields is considered a different term. Thus terms are represented as a pair: the string naming the field, and the bytes within the field.
### Inverted Indexing
The index stores statistics about terms in order to make term-based search more efficient. Lucene&#39;s index falls into the family of indexes known as an <em>inverted index.</em> This is because it can list, for a term, the documents that contain it. This is the inverse of the natural relationship, in which documents list terms.
### Types of Fields
In Lucene, fields may be <em>stored</em>, in which case their text is stored in the index literally, in a non-inverted manner. Fields that are inverted are called <em>indexed</em>. A field may be both stored and indexed.
The text of a field may be <em>tokenized</em> into terms to be indexed, or the text of a field may be used literally as a term to be indexed. Most fields are tokenized, but sometimes it is useful for certain identifier fields to be indexed literally.
See the <a class="xref" href="Lucene.Net.Documents.Field.html">Field</a> java docs for more information on Fields.
### Segments
Lucene indexes may be composed of multiple sub-indexes, or <em>segments</em>. Each segment is a fully independent index, which could be searched separately. Indexes evolve by:
1. Creating new segments for newly added documents.
2. Merging existing segments.
Searches may involve multiple segments and/or multiple indexes, each index potentially composed of a set of segments.
### Document Numbers
Internally, Lucene refers to documents by an integer <em>document number</em>. The first document added to an index is numbered zero, and each subsequent document added gets a number one greater than the previous.
Note that a document&#39;s number may change, so caution should be taken when storing these numbers outside of Lucene. In particular, numbers may change in the following situations:
*<br>
The numbers stored in each segment are unique only within the segment, and must be converted before they can be used in a larger context. The standard technique is to allocate each segment a range of values, based on the range of numbers used in that segment. To convert a document number from a segment to an external value, the segment&#39;s <em>base</em> document number is added. To convert an external value back to a segment-specific value, the segment is identified by the range that the external value is in, and the segment&#39;s base value is subtracted. For example two five document segments might be combined, so that the first segment has a base value of zero, and the second of five. Document three from the second segment would have an external value of eight.
*<br>
When documents are deleted, gaps are created in the numbering. These are eventually removed as the index evolves through merging. Deleted documents are dropped when segments are merged. A freshly-merged segment thus has no gaps in its numbering.
</div>
<h2 id="index-structure-overview">Index Structure Overview</h2>
<div>
Each segment index maintains the following:
* <a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40SegmentInfoFormat.html">Segment info</a>.
This contains metadata about a segment, such as the number of documents,
what files it uses,
* <a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42FieldInfosFormat.html">Field names</a>.
This contains the set of field names used in the index.
* <a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41StoredFieldsFormat.html">Stored Field values</a>.
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.
* <a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Term dictionary</a>.
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&#39;s frequency and
proximity data.
* <a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Term Frequency data</a>.
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)
* <a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Term Proximity data</a>.
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.
* <a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat.html">Normalization factors</a>.
For each field in each document, a value is stored
that is multiplied into the score for hits on that field.
* <a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42TermVectorsFormat.html">Term Vectors</a>.
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
<a class="xref" href="Lucene.Net.Documents.Field.html">Field</a> constructors
* <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat.html">Per-document values</a>.
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.
* <a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40LiveDocsFormat.html">Deleted documents</a>.
An optional file indicating which documents are deleted.
Details on each of these are provided in their linked pages.
</div>
<h2 id="file-naming">File Naming</h2>
<div>
All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats described below. When using the Compound File format (default in 1.4 and greater) these files (except for the Segment info file, the Lock file, and Deleted documents file) are collapsed into a single .cfs file (see below for details)
Typically, all segments in an index are stored in a single directory, although this is not required.
As of version 2.1 (lock-less commits), file names are never re-used (there is one exception, &quot;segments.gen&quot;, see below). That is, when any file is saved to the Directory it is given a never before used filename. This is achieved using a simple generations approach. For example, the first segments file is segments_1, then segments_2, etc. The generation is a sequential long integer represented in alpha-numeric (base 36) form.
</div>
<h2 id="summary-of-file-extensions">Summary of File Extensions</h2>
<div>
The following table summarizes the names and extensions of the files in Lucene:
<table cellspacing="1" cellpadding="4">
<tr>
<th>Name</th>
<th>Extension</th>
<th>Brief Description</th>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Index.SegmentInfos.html">Segments File</a></td>
<td>segments.gen, segments_N</td>
<td>Stores information about a commit point</td>
</tr>
<tr>
<td><a href="#lock-file">Lock File</a></td>
<td>write.lock</td>
<td>The Write lock prevents multiple IndexWriters from writing to the same
file.</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40SegmentInfoFormat.html">Segment Info</a></td>
<td>.si</td>
<td>Stores metadata about a segment</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Store.CompoundFileDirectory.html">Compound File</a></td>
<td>.cfs, .cfe</td>
<td>An optional &quot;virtual&quot; file consisting of all the other index files for
systems that frequently run out of file handles.</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42FieldInfosFormat.html">Fields</a></td>
<td>.fnm</td>
<td>Stores information about the fields</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41StoredFieldsFormat.html">Field Index</a></td>
<td>.fdx</td>
<td>Contains pointers to field data</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41StoredFieldsFormat.html">Field Data</a></td>
<td>.fdt</td>
<td>The stored fields for documents</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Term Dictionary</a></td>
<td>.tim</td>
<td>The term dictionary, stores term info</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Term Index</a></td>
<td>.tip</td>
<td>The index into the Term Dictionary</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Frequencies</a></td>
<td>.doc</td>
<td>Contains the list of docs which contain each term along with frequency</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Positions</a></td>
<td>.pos</td>
<td>Stores position information about where a term occurs in the index</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Payloads</a></td>
<td>.pay</td>
<td>Stores additional per-position metadata information such as character offsets and user payloads</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat.html">Norms</a></td>
<td>.nvd, .nvm</td>
<td>Encodes length and boost factors for docs and fields</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat.html">Per-Document Values</a></td>
<td>.dvd, .dvm</td>
<td>Encodes additional scoring factors or other per-document information.</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42TermVectorsFormat.html">Term Vector Index</a></td>
<td>.tvx</td>
<td>Stores offset into the document data file</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42TermVectorsFormat.html">Term Vector Documents</a></td>
<td>.tvd</td>
<td>Contains information about each document that has term vectors</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42TermVectorsFormat.html">Term Vector Fields</a></td>
<td>.tvf</td>
<td>The field level info about term vectors</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40LiveDocsFormat.html">Deleted Documents</a></td>
<td>.del</td>
<td>Info about what files are deleted</td>
</tr>
</table>
</div>
<h2 id="lock-file">Lock File</h2>
<p>The write lock, which is stored in the index directory by default, is named
&quot;write.lock&quot;. If the lock directory is different from the index directory then
the write lock will be named &quot;XXXX-write.lock&quot; where XXXX is a unique prefix
derived from the full path to the index directory. When this file is present, a
writer is currently modifying the index (adding or removing documents). This
lock file ensures that only one writer is modifying the index at a time.</p>
<h2 id="history">History</h2>
<p>Compatibility notes are provided in this document, describing how file formats have changed from prior versions:</p>
<ul>
<li><p>In version 2.1, the file format was changed to allow lock-less commits (ie,
no more commit lock). The change is fully backwards compatible: you can open a
pre-2.1 index for searching or adding/deleting of docs. When the new segments
file is saved (committed), it will be written in the new file format (meaning
no specific &quot;upgrade&quot; process is needed). But note that once a commit has
occurred, pre-2.1 Lucene will not be able to read the index.</p>
</li>
<li><p>In version 2.3, the file format was changed to allow segments to share a
single set of doc store (vectors &amp; stored fields) files. This allows for
faster indexing in certain cases. The change is fully backwards compatible (in
the same way as the lock-less commits change in 2.1).</p>
</li>
<li><p>In version 2.4, Strings are now written as true UTF-8 byte sequence, not
Java&#39;s modified UTF-8. See <a href="http://issues.apache.org/jira/browse/LUCENE-510">
LUCENE-510</a> for details.</p>
</li>
<li><p>In version 2.9, an optional opaque Map&lt;String,String&gt; CommitUserData
may be passed to IndexWriter&#39;s commit methods (and later retrieved), which is
recorded in the segments_N file. See <a href="http://issues.apache.org/jira/browse/LUCENE-1382">
LUCENE-1382</a> for details. Also,
diagnostics were added to each segment written recording details about why it
was written (due to flush, merge; which OS/JRE was used; etc.). See issue
<a href="http://issues.apache.org/jira/browse/LUCENE-1654">LUCENE-1654</a> for details.</p>
</li>
<li><p>In version 3.0, compressed fields are no longer written to the index (they
can still be read, but on merge the new segment will write them, uncompressed).
See issue <a href="http://issues.apache.org/jira/browse/LUCENE-1960">LUCENE-1960</a>
for details.</p>
</li>
<li><p>In version 3.1, segments records the code version that created them. See
<a href="http://issues.apache.org/jira/browse/LUCENE-2720">LUCENE-2720</a> for details.
Additionally segments track explicitly whether or not they have term vectors.
See <a href="http://issues.apache.org/jira/browse/LUCENE-2811">LUCENE-2811</a>
for details.</p>
</li>
<li><p>In version 3.2, numeric fields are written as natively to stored fields
file, previously they were stored in text format only.</p>
</li>
<li><p>In version 3.4, fields can omit position data while still indexing term
frequencies.</p>
</li>
<li><p>In version 4.0, the format of the inverted index became extensible via
the <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a> api. Fast per-document storage
({@code DocValues}) was introduced. Normalization factors need no longer be a
single byte, they can be any <a class="xref" href="Lucene.Net.Index.NumericDocValues.html">NumericDocValues</a>.
Terms need not be unicode strings, they can be any byte sequence. Term offsets
can optionally be indexed into the postings lists. Payloads can be stored in the
term vectors.</p>
</li>
<li><p>In version 4.1, the format of the postings list changed to use either
of FOR compression or variable-byte encoding, depending upon the frequency
of the term. Terms appearing only once were changed to inline directly into
the term dictionary. Stored fields are compressed by default. </p>
</li>
<li><p>In version 4.2, term vectors are compressed by default. DocValues has
a new multi-valued type (SortedSet), that can be used for faceting/grouping/joining
on multi-valued fields.</p>
</li>
<li><p>In version 4.5, DocValues were extended to explicitly represent missing values.</p>
</li>
</ul>
<h2 id="limitations">Limitations</h2>
<div>
Lucene uses a Java <code>int</code> to refer to document numbers, and the index file format uses an <code>Int32</code> on-disk to store document numbers. This is a limitation of both the index file format and the current implementation. Eventually these should be replaced with either <code>UInt64</code> values, or better yet, <a class="xref" href="Lucene.Net.Store.DataOutput.html#methods">VInt</a> values which have no limit.
</div></div>
<div class="markdown level0 conceptual"></div>
<div class="markdown level0 remarks"></div>
<h3 id="classes">Classes
</h3>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45Codec.html">Lucene45Codec</a></h4>
<section><p>Implements the Lucene 4.5 index format, with configurable per-field postings
and docvalues formats.
<p>
If you want to reuse functionality of this codec in another codec, extend
<a class="xref" href="Lucene.Net.Codecs.FilterCodec.html">FilterCodec</a>.
<p>
See <a class="xref" href="Lucene.Net.Codecs.Lucene45.html">Lucene.Net.Codecs.Lucene45</a> package documentation for file format details.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div><p>
</section>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesConsumer.html">Lucene45DocValuesConsumer</a></h4>
<section><p>Writer for <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat.html">Lucene45DocValuesFormat</a> </p>
</section>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat.html">Lucene45DocValuesFormat</a></h4>
<section><p>Lucene 4.5 DocValues format.
<p>
Encodes the four per-document value types (Numeric,Binary,Sorted,SortedSet) with these strategies:
<p>
<a class="xref" href="Lucene.Net.Index.DocValuesType.html#Lucene_Net_Index_DocValuesType_NUMERIC">NUMERIC</a>:
<ul><li>Delta-compressed: per-document integers written in blocks of 16k. For each block
the minimum value in that block is encoded, and each entry is a delta from that
minimum value. Each block of deltas is compressed with bitpacking. For more
information, see <a class="xref" href="Lucene.Net.Util.Packed.BlockPackedWriter.html">BlockPackedWriter</a>.</li><li>Table-compressed: when the number of unique values is very small (&lt; 256), and
when there are unused &quot;gaps&quot; in the range of values used (such as <a class="xref" href="Lucene.Net.Util.SmallSingle.html">SmallSingle</a>),
a lookup table is written instead. Each per-document entry is instead the ordinal
to this table, and those ordinals are compressed with bitpacking (<a class="xref" href="Lucene.Net.Util.Packed.PackedInt32s.html">PackedInt32s</a>).</li><li>GCD-compressed: when all numbers share a common divisor, such as dates, the greatest
common denominator (GCD) is computed, and quotients are stored using Delta-compressed Numerics.</li></ul>
<p>
<a class="xref" href="Lucene.Net.Index.DocValuesType.html#Lucene_Net_Index_DocValuesType_BINARY">BINARY</a>:
<ul><li>Fixed-width Binary: one large concatenated <span class="xref">byte[]</span> is written, along with the fixed length.
Each document&apos;s value can be addressed directly with multiplication (<code>docID * length</code>).</li><li>Variable-width Binary: one large concatenated <span class="xref">byte[]</span> is written, along with end addresses
for each document. The addresses are written in blocks of 16k, with the current absolute
start for the block, and the average (expected) delta per entry. For each document the
deviation from the delta (actual - expected) is written.</li><li>Prefix-compressed Binary: values are written in chunks of 16, with the first value written
completely and other values sharing prefixes. Chunk addresses are written in blocks of 16k,
with the current absolute start for the block, and the average (expected) delta per entry.
For each chunk the deviation from the delta (actual - expected) is written.</li></ul>
<p>
<a class="xref" href="Lucene.Net.Index.DocValuesType.html#Lucene_Net_Index_DocValuesType_SORTED">SORTED</a>:
<ul><li>Sorted: a mapping of ordinals to deduplicated terms is written as Prefix-Compressed Binary,
along with the per-document ordinals written using one of the numeric strategies above.</li></ul>
<p>
<a class="xref" href="Lucene.Net.Index.DocValuesType.html#Lucene_Net_Index_DocValuesType_SORTED_SET">SORTED_SET</a>:
<ul><li>SortedSet: a mapping of ordinals to deduplicated terms is written as Prefix-Compressed Binary,
an ordinal list and per-document index into this list are written using the numeric strategies
above.</li></ul>
<p>
Files:
<ol><li><code>.dvd</code>: DocValues data</li><li><code>.dvm</code>: DocValues metadata</li></ol>
<ol><li><a name="dvm" id="dvm"></a>
<p>The DocValues metadata or .dvm file.</p>
<p>For DocValues field, this stores metadata, such as the offset into the
DocValues data (.dvd)</p>
<p>DocValues metadata (.dvm) --&gt; Header,&lt;Entry&gt;<sup>NumFields</sup>,Footer</p>
<ul><li>Entry --&gt; NumericEntry | BinaryEntry | SortedEntry | SortedSetEntry</li><li>NumericEntry --&gt; GCDNumericEntry | TableNumericEntry | DeltaNumericEntry</li><li>GCDNumericEntry --&gt; NumericHeader,MinValue,GCD</li><li>TableNumericEntry --&gt; NumericHeader,TableSize,Int64 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt64_System_Int64_">WriteInt64(Int64)</a>) <sup>TableSize</sup></li><li>DeltaNumericEntry --&gt; NumericHeader</li><li>NumericHeader --&gt; FieldNumber,EntryType,NumericType,MissingOffset,PackedVersion,DataOffset,Count,BlockSize</li><li>BinaryEntry --&gt; FixedBinaryEntry | VariableBinaryEntry | PrefixBinaryEntry</li><li>FixedBinaryEntry --&gt; BinaryHeader</li><li>VariableBinaryEntry --&gt; BinaryHeader,AddressOffset,PackedVersion,BlockSize</li><li>PrefixBinaryEntry --&gt; BinaryHeader,AddressInterval,AddressOffset,PackedVersion,BlockSize</li><li>BinaryHeader --&gt; FieldNumber,EntryType,BinaryType,MissingOffset,MinLength,MaxLength,DataOffset</li><li>SortedEntry --&gt; FieldNumber,EntryType,BinaryEntry,NumericEntry</li><li>SortedSetEntry --&gt; EntryType,BinaryEntry,NumericEntry,NumericEntry</li><li>FieldNumber,PackedVersion,MinLength,MaxLength,BlockSize,ValueCount --&gt; VInt (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteVInt32_System_Int32_">WriteVInt32(Int32)</a></li><li>EntryType,CompressionType --&gt; Byte (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteByte_System_Byte_">WriteByte(Byte)</a></li><li>Header --&gt; CodecHeader (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a>) </li><li>MinValue,GCD,MissingOffset,AddressOffset,DataOffset --&gt; Int64 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt64_System_Int64_">WriteInt64(Int64)</a>) </li><li>TableSize --&gt; vInt (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteVInt32_System_Int32_">WriteVInt32(Int32)</a>) </li><li>Footer --&gt; CodecFooter (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_">WriteFooter(IndexOutput)</a>) </li></ul>
<p>Sorted fields have two entries: a <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.BinaryEntry.html">Lucene45DocValuesProducer.BinaryEntry</a> with the value metadata,
and an ordinary <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.NumericEntry.html">Lucene45DocValuesProducer.NumericEntry</a> for the document-to-ord metadata.</p>
<p>SortedSet fields have three entries: a <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.BinaryEntry.html">Lucene45DocValuesProducer.BinaryEntry</a> with the value metadata,
and two <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.NumericEntry.html">Lucene45DocValuesProducer.NumericEntry</a>s for the document-to-ord-index and ordinal list metadata.</p>
<p>FieldNumber of -1 indicates the end of metadata.</p>
<p>EntryType is a 0 (<a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.NumericEntry.html">Lucene45DocValuesProducer.NumericEntry</a>) or 1 (<a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.BinaryEntry.html">Lucene45DocValuesProducer.BinaryEntry</a>)</p>
<p>DataOffset is the pointer to the start of the data in the DocValues data (.dvd)</p>
<p>NumericType indicates how Numeric values will be compressed:
<ul><li>0 --&gt; delta-compressed. For each block of 16k integers, every integer is delta-encoded
from the minimum value within the block.</li><li>1 --&gt; gcd-compressed. When all integers share a common divisor, only quotients are stored
using blocks of delta-encoded ints.</li><li>2 --&gt; table-compressed. When the number of unique numeric values is small and it would save space,
a lookup table of unique values is written, followed by the ordinal for each document.</li></ul>
<p>BinaryType indicates how Binary values will be stored:
<ul><li>0 --&gt; fixed-width. All values have the same length, addressing by multiplication.</li><li>1 --&gt; variable-width. An address for each value is stored.</li><li>2 --&gt; prefix-compressed. An address to the start of every interval&apos;th value is stored.</li></ul>
<p>MinLength and MaxLength represent the min and max byte[] value lengths for Binary values.
If they are equal, then all values are of a fixed size, and can be addressed as DataOffset + (docID * length).
Otherwise, the binary values are of variable size, and packed integer metadata (PackedVersion,BlockSize)
is written for the addresses.
<p>MissingOffset points to a <span class="xref">byte[]</span> containing a bitset of all documents that had a value for the field.
If its -1, then there are no missing values.
<p>Checksum contains the CRC32 checksum of all bytes in the .dvm file up
until the checksum. this is used to verify integrity of the file on opening the
index.</li><li><a name="dvd" id="dvd"></a>
<p>The DocValues data or .dvd file.</p>
<p>For DocValues field, this stores the actual per-document data (the heavy-lifting)</p>
<p>DocValues data (.dvd) --&gt; Header,&lt;NumericData | BinaryData | SortedData&gt;<sup>NumFields</sup>,Footer</p>
<ul><li>NumericData --&gt; DeltaCompressedNumerics | TableCompressedNumerics | GCDCompressedNumerics</li><li>BinaryData --&gt; Byte (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteByte_System_Byte_">WriteByte(Byte)</a>) <sup>DataLength</sup>,Addresses</li><li>SortedData --&gt; FST&lt;Int64&gt; (<a class="xref" href="Lucene.Net.Util.Fst.FST-1.html">FST&lt;T&gt;</a>) </li><li>DeltaCompressedNumerics --&gt; BlockPackedInts(blockSize=16k) (<a class="xref" href="Lucene.Net.Util.Packed.BlockPackedWriter.html">BlockPackedWriter</a>) </li><li>TableCompressedNumerics --&gt; PackedInts (<a class="xref" href="Lucene.Net.Util.Packed.PackedInt32s.html">PackedInt32s</a>) </li><li>GCDCompressedNumerics --&gt; BlockPackedInts(blockSize=16k) (<a class="xref" href="Lucene.Net.Util.Packed.BlockPackedWriter.html">BlockPackedWriter</a>) </li><li>Addresses --&gt; MonotonicBlockPackedInts(blockSize=16k) (<a class="xref" href="Lucene.Net.Util.Packed.MonotonicBlockPackedWriter.html">MonotonicBlockPackedWriter</a>) </li><li>Footer --&gt; CodecFooter (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_">WriteFooter(IndexOutput)</a>) </li></ul>
<p>SortedSet entries store the list of ordinals in their BinaryData as a
sequences of increasing vLongs (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteVInt64_System_Int64_">WriteVInt64(Int64)</a>), delta-encoded.</p></li></ol>
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></section>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.html">Lucene45DocValuesProducer</a></h4>
<section><p>Reader for <a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat.html">Lucene45DocValuesFormat</a>. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.BinaryEntry.html">Lucene45DocValuesProducer.BinaryEntry</a></h4>
<section><p>Metadata entry for a binary docvalues field. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.NumericEntry.html">Lucene45DocValuesProducer.NumericEntry</a></h4>
<section><p>Metadata entry for a numeric docvalues field. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesProducer.SortedSetEntry.html">Lucene45DocValuesProducer.SortedSetEntry</a></h4>
<section><p>Metadata entry for a sorted-set docvalues field. </p>
</section>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/blob/docs/4.8.0-beta00013/src/Lucene.Net/Codecs/Lucene45/package.md/#L2" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 The Apache Software Foundation, Licensed under the <a href='http://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache License, Version 2.0</a><br> <small>Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. <br>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</small>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>