blob: 53db23c17d7e368fa9589d7aaced3e297409f91f [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>Class IndexWriter
| Apache Lucene.NET 4.8.0-beta00010 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class IndexWriter
| Apache Lucene.NET 4.8.0-beta00010 Documentation ">
<meta name="generator" content="docfx 2.56.0.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">
<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.Index.IndexWriter">
<h1 id="Lucene_Net_Index_IndexWriter" data-uid="Lucene.Net.Index.IndexWriter" class="text-break">Class IndexWriter
</h1>
<div class="markdown level0 summary"><p>An <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> creates and maintains an index.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">IndexWriter</span></div>
</div>
<div classs="implements">
<h5>Implements</h5>
<div><span class="xref">System.IDisposable</span></div>
<div><a class="xref" href="Lucene.Net.Index.ITwoPhaseCommit.html">ITwoPhaseCommit</a></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<span class="xref">System.Object.Equals(System.Object)</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetHashCode()</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.ToString()</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Lucene.Net.Index.html">Lucene.Net.Index</a></h6>
<h6><strong>Assembly</strong>: Lucene.Net.dll</h6>
<h5 id="Lucene_Net_Index_IndexWriter_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class IndexWriter : IDisposable, ITwoPhaseCommit</code></pre>
</div>
<h5 id="Lucene_Net_Index_IndexWriter_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>The <a class="xref" href="Lucene.Net.Index.OpenMode.html">OpenMode</a> option on
<a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html#Lucene_Net_Index_IndexWriterConfig_OpenMode">OpenMode</a> determines
whether a new index is created, or whether an existing index is
opened. Note that you can open an index with <a class="xref" href="Lucene.Net.Index.OpenMode.html#Lucene_Net_Index_OpenMode_CREATE">CREATE</a>
even while readers are using the index. The old readers will
continue to search the &quot;point in time&quot; snapshot they had opened,
and won&apos;t see the newly created index until they re-open. If
<a class="xref" href="Lucene.Net.Index.OpenMode.html#Lucene_Net_Index_OpenMode_CREATE_OR_APPEND">CREATE_OR_APPEND</a> is used <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> will create a
new index if there is not already an index at the provided path
and otherwise open the existing index.</p>
<p>In either case, documents are added with <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__">AddDocument(IEnumerable&lt;IIndexableField&gt;)</a>
and removed with <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Index_Term_">DeleteDocuments(Term)</a> or
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query_">DeleteDocuments(Query)</a>. A document can be updated with
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_UpdateDocument_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__">UpdateDocument(Term, IEnumerable&lt;IIndexableField&gt;)</a> (which just deletes
and then adds the entire document). When finished adding, deleting
and updating documents, <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose">Dispose()</a> should be called.</p>
<p><a name="flush"></a>
<p>These changes are buffered in memory and periodically
flushed to the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a> (during the above method
calls). A flush is triggered when there are enough added documents
since the last flush. Flushing is triggered either by RAM usage of the
documents (see <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_RAMBufferSizeMB">RAMBufferSizeMB</a>) or the
number of added documents (see <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_MaxBufferedDocs">MaxBufferedDocs</a>).
The default is to flush when RAM usage hits
<a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html#Lucene_Net_Index_IndexWriterConfig_DEFAULT_RAM_BUFFER_SIZE_MB">DEFAULT_RAM_BUFFER_SIZE_MB</a> MB. For
best indexing speed you should flush by RAM usage with a
large RAM buffer. Additionally, if <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> reaches the configured number of
buffered deletes (see <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_MaxBufferedDeleteTerms">MaxBufferedDeleteTerms</a>)
the deleted terms and queries are flushed and applied to existing segments.
In contrast to the other flush options <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_RAMBufferSizeMB">RAMBufferSizeMB</a> and
<a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_MaxBufferedDocs">MaxBufferedDocs</a>, deleted terms
won&apos;t trigger a segment flush. Note that flushing just moves the
internal buffered state in <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> into the index, but
these changes are not visible to <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> until either
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> or <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose">Dispose()</a> is called. A flush may
also trigger one or more segment merges which by default
run with a background thread so as not to block the
addDocument calls (see <a href="#mergePolicy">below</a>
for changing the <span class="xref">Lucene.Net.Index.IndexWriter.mergeScheduler</span>).</p></p>
<p>Opening an <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> creates a lock file for the directory in use. Trying to open
another <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> on the same directory will lead to a
<a class="xref" href="Lucene.Net.Store.LockObtainFailedException.html">LockObtainFailedException</a>. The <a class="xref" href="Lucene.Net.Store.LockObtainFailedException.html">LockObtainFailedException</a>
is also thrown if an <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> on the same directory is used to delete documents
from the index.</p>
<p><a name="deletionPolicy"></a>
<p>Expert: <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> allows an optional
<a class="xref" href="Lucene.Net.Index.IndexDeletionPolicy.html">IndexDeletionPolicy</a> implementation to be
specified. You can use this to control when prior commits
are deleted from the index. The default policy is
<a class="xref" href="Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy.html">KeepOnlyLastCommitDeletionPolicy</a> which removes all prior
commits as soon as a new commit is done (this matches
behavior before 2.2). Creating your own policy can allow
you to explicitly keep previous &quot;point in time&quot; commits
alive in the index for some time, to allow readers to
refresh to the new commit without having the old commit
deleted out from under them. This is necessary on
filesystems like NFS that do not support &quot;delete on last
close&quot; semantics, which Lucene&apos;s &quot;point in time&quot; search
normally relies on. </p></p>
<p><a name="mergePolicy"></a> <p>Expert:
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> allows you to separately change
the <span class="xref">Lucene.Net.Index.IndexWriter.mergePolicy</span> and the <span class="xref">Lucene.Net.Index.IndexWriter.mergeScheduler</span>.
The <span class="xref">Lucene.Net.Index.IndexWriter.mergePolicy</span> is invoked whenever there are
changes to the segments in the index. Its role is to
select which merges to do, if any, and return a
<a class="xref" href="Lucene.Net.Index.MergePolicy.MergeSpecification.html">MergePolicy.MergeSpecification</a> describing the merges.
The default is <a class="xref" href="Lucene.Net.Index.LogByteSizeMergePolicy.html">LogByteSizeMergePolicy</a>. Then, the
<a class="xref" href="Lucene.Net.Index.MergeScheduler.html">MergeScheduler</a> is invoked with the requested merges and
it decides when and how to run the merges. The default is
<a class="xref" href="Lucene.Net.Index.ConcurrentMergeScheduler.html">ConcurrentMergeScheduler</a>. </p></p>
<p><a name="OOME"></a><p><strong>NOTE</strong>: if you hit an
<span class="xref">System.OutOfMemoryException</span> then <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> will quietly record this
fact and block all future segment commits. This is a
defensive measure in case any internal state (buffered
documents and deletions) were corrupted. Any subsequent
calls to <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> will throw an
<span class="xref">System.InvalidOperationException</span>. The only course of action is to
call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose">Dispose()</a>, which internally will call
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Rollback">Rollback()</a>, to undo any changes to the index since the
last commit. You can also just call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Rollback">Rollback()</a>
directly.</p></p>
<p><a name="thread-safety"></a><p><strong>NOTE</strong>:
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> instances are completely thread
safe, meaning multiple threads can call any of its
methods, concurrently. If your application requires
external synchronization, you should <strong>not</strong>
synchronize on the <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> instance as
this may cause deadlock; use your own (non-Lucene) objects
instead. </p></p>
<p><strong>NOTE</strong>: If you call
<span class="xref">System.Threading.Thread.Interrupt</span> on a thread that&apos;s within
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>, <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> will try to catch this (eg, if
it&apos;s in a Wait() or <span class="xref">System.Threading.Thread.Sleep(System.Int32)</span>), and will then throw
the unchecked exception <span class="xref">System.Threading.ThreadInterruptedException</span>
and <strong>clear</strong> the interrupt status on the thread.</p>
</div>
<h3 id="constructors">Constructors
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter__ctor_Lucene_Net_Store_Directory_Lucene_Net_Index_IndexWriterConfig_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.%23ctor(Lucene.Net.Store.Directory%2CLucene.Net.Index.IndexWriterConfig)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L814">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter__ctor_" data-uid="Lucene.Net.Index.IndexWriter.#ctor*"></a>
<h4 id="Lucene_Net_Index_IndexWriter__ctor_Lucene_Net_Store_Directory_Lucene_Net_Index_IndexWriterConfig_" data-uid="Lucene.Net.Index.IndexWriter.#ctor(Lucene.Net.Store.Directory,Lucene.Net.Index.IndexWriterConfig)">IndexWriter(Directory, IndexWriterConfig)</h4>
<div class="markdown level1 summary"><p>Constructs a new <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> per the settings given in <code data-dev-comment-type="paramref" class="paramref">conf</code>.
If you want to make &quot;live&quot; changes to this writer instance, use
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Config">Config</a>.</p>
<p><p>
<strong>NOTE:</strong> after ths writer is created, the given configuration instance
cannot be passed to another writer. If you intend to do so, you should
<a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html#Lucene_Net_Index_IndexWriterConfig_Clone">Clone()</a> it beforehand.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IndexWriter(Directory d, IndexWriterConfig conf)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a></td>
<td><span class="parametername">d</span></td>
<td><p>the index directory. The index is either created or appended
according <a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html#Lucene_Net_Index_IndexWriterConfig_OpenMode">OpenMode</a>. </p>
</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html">IndexWriterConfig</a></td>
<td><span class="parametername">conf</span></td>
<td><p>the configuration settings according to which <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> should
be initialized. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if the directory cannot be read/written to, or if it does not
exist and <a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html#Lucene_Net_Index_IndexWriterConfig_OpenMode">OpenMode</a> is
<a class="xref" href="Lucene.Net.Index.OpenMode.html#Lucene_Net_Index_OpenMode_APPEND">APPEND</a> or if there is any other low-level
IO error </p>
</td>
</tr>
</tbody>
</table>
<h3 id="fields">Fields
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_MAX_TERM_LENGTH.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.MAX_TERM_LENGTH%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L217">View Source</a>
</span>
<h4 id="Lucene_Net_Index_IndexWriter_MAX_TERM_LENGTH" data-uid="Lucene.Net.Index.IndexWriter.MAX_TERM_LENGTH">MAX_TERM_LENGTH</h4>
<div class="markdown level1 summary"><p>Absolute hard maximum length for a term, in bytes once
encoded as UTF8. If a term arrives from the analyzer
longer than this length, an
<span class="xref">System.ArgumentException</span> is thrown
and a message is printed to <span class="xref">Lucene.Net.Index.IndexWriter.infoStream</span>, if set (see
<a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html#Lucene_Net_Index_IndexWriterConfig_SetInfoStream_Lucene_Net_Util_InfoStream_">SetInfoStream(InfoStream)</a>).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly int MAX_TERM_LENGTH</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SOURCE.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SOURCE%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L195">View Source</a>
</span>
<h4 id="Lucene_Net_Index_IndexWriter_SOURCE" data-uid="Lucene.Net.Index.IndexWriter.SOURCE">SOURCE</h4>
<div class="markdown level1 summary"><p>Key for the source of a segment in the <a class="xref" href="Lucene.Net.Index.SegmentInfo.html#Lucene_Net_Index_SegmentInfo_Diagnostics">Diagnostics</a>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly string SOURCE</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SOURCE_ADDINDEXES_READERS.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SOURCE_ADDINDEXES_READERS%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L207">View Source</a>
</span>
<h4 id="Lucene_Net_Index_IndexWriter_SOURCE_ADDINDEXES_READERS" data-uid="Lucene.Net.Index.IndexWriter.SOURCE_ADDINDEXES_READERS">SOURCE_ADDINDEXES_READERS</h4>
<div class="markdown level1 summary"><p>Source of a segment which results from a call to <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Index_IndexReader___">AddIndexes(IndexReader[])</a>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly string SOURCE_ADDINDEXES_READERS</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SOURCE_FLUSH.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SOURCE_FLUSH%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L203">View Source</a>
</span>
<h4 id="Lucene_Net_Index_IndexWriter_SOURCE_FLUSH" data-uid="Lucene.Net.Index.IndexWriter.SOURCE_FLUSH">SOURCE_FLUSH</h4>
<div class="markdown level1 summary"><p>Source of a segment which results from a flush. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly string SOURCE_FLUSH</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SOURCE_MERGE.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SOURCE_MERGE%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L199">View Source</a>
</span>
<h4 id="Lucene_Net_Index_IndexWriter_SOURCE_MERGE" data-uid="Lucene.Net.Index.IndexWriter.SOURCE_MERGE">SOURCE_MERGE</h4>
<div class="markdown level1 summary"><p>Source of a segment which results from a merge of other segments. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly string SOURCE_MERGE</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_WRITE_LOCK_NAME.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.WRITE_LOCK_NAME%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L191">View Source</a>
</span>
<h4 id="Lucene_Net_Index_IndexWriter_WRITE_LOCK_NAME" data-uid="Lucene.Net.Index.IndexWriter.WRITE_LOCK_NAME">WRITE_LOCK_NAME</h4>
<div class="markdown level1 summary"><p>Name of the write lock in the index.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly string WRITE_LOCK_NAME</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="properties">Properties
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Analyzer.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Analyzer%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1315">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Analyzer_" data-uid="Lucene.Net.Index.IndexWriter.Analyzer*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Analyzer" data-uid="Lucene.Net.Index.IndexWriter.Analyzer">Analyzer</h4>
<div class="markdown level1 summary"><p>Gets the analyzer used by this index. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual Analyzer Analyzer { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Analysis.Analyzer.html">Analyzer</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_CommitData.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.CommitData%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3663">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_CommitData_" data-uid="Lucene.Net.Index.IndexWriter.CommitData*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_CommitData" data-uid="Lucene.Net.Index.IndexWriter.CommitData">CommitData</h4>
<div class="markdown level1 summary"><p>Returns the commit user data map that was last committed, or the one that
was set on <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_SetCommitData_System_Collections_Generic_IDictionary_System_String_System_String__">SetCommitData(IDictionary&lt;String, String&gt;)</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IDictionary&lt;string, string&gt; CommitData { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IDictionary</span>&lt;<span class="xref">System.String</span>, <span class="xref">System.String</span>&gt;</td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Config.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Config%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L982">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Config_" data-uid="Lucene.Net.Index.IndexWriter.Config*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Config" data-uid="Lucene.Net.Index.IndexWriter.Config">Config</h4>
<div class="markdown level1 summary"><p>Returns a <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html">LiveIndexWriterConfig</a>, which can be used to query the <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>
current settings, as well as modify &quot;live&quot; ones.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual LiveIndexWriterConfig Config { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html">LiveIndexWriterConfig</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Directory.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Directory%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1311">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Directory_" data-uid="Lucene.Net.Index.IndexWriter.Directory*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Directory" data-uid="Lucene.Net.Index.IndexWriter.Directory">Directory</h4>
<div class="markdown level1 summary"><p>Gets the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a> used by this index. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual Directory Directory { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_IsClosed.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.IsClosed%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5652">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_IsClosed_" data-uid="Lucene.Net.Index.IndexWriter.IsClosed*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_IsClosed" data-uid="Lucene.Net.Index.IndexWriter.IsClosed">IsClosed</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual bool IsClosed { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_KeepFullyDeletedSegments.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.KeepFullyDeletedSegments%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5370">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_KeepFullyDeletedSegments_" data-uid="Lucene.Net.Index.IndexWriter.KeepFullyDeletedSegments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_KeepFullyDeletedSegments" data-uid="Lucene.Net.Index.IndexWriter.KeepFullyDeletedSegments">KeepFullyDeletedSegments</h4>
<div class="markdown level1 summary"><p>Only for testing.
<p>
<div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual bool KeepFullyDeletedSegments { get; set; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_MaxDoc.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.MaxDoc%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1330">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_MaxDoc_" data-uid="Lucene.Net.Index.IndexWriter.MaxDoc*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_MaxDoc" data-uid="Lucene.Net.Index.IndexWriter.MaxDoc">MaxDoc</h4>
<div class="markdown level1 summary"><p>Gets total number of docs in this index, including
docs not yet flushed (still in the RAM buffer),
not counting deletions.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual int MaxDoc { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Index_IndexWriter_MaxDoc_seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_NumDocs">NumDocs</a></div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_MergingSegments.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.MergingSegments%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2442">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_MergingSegments_" data-uid="Lucene.Net.Index.IndexWriter.MergingSegments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_MergingSegments" data-uid="Lucene.Net.Index.IndexWriter.MergingSegments">MergingSegments</h4>
<div class="markdown level1 summary"><p>Expert: to be used by a <a class="xref" href="Lucene.Net.Index.MergePolicy.html">MergePolicy</a> to avoid
selecting merges for segments already being merged.
The returned collection is not cloned, and thus is
only safe to access if you hold <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>&apos;s lock
(which you do when <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> invokes the
<a class="xref" href="Lucene.Net.Index.MergePolicy.html">MergePolicy</a>).
<p>
Do not alter the returned collection!</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual ICollection&lt;SegmentCommitInfo&gt; MergingSegments { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.ICollection</span>&lt;<a class="xref" href="Lucene.Net.Index.SegmentCommitInfo.html">SegmentCommitInfo</a>&gt;</td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_NumDocs.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.NumDocs%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1350">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_NumDocs_" data-uid="Lucene.Net.Index.IndexWriter.NumDocs*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_NumDocs" data-uid="Lucene.Net.Index.IndexWriter.NumDocs">NumDocs</h4>
<div class="markdown level1 summary"><p>Gets total number of docs in this index, including
docs not yet flushed (still in the RAM buffer), and
including deletions. <strong>NOTE:</strong> buffered deletions
are not counted. If you really need these to be
counted you should call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> first.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual int NumDocs { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Index_IndexWriter_NumDocs_seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_MaxDoc">MaxDoc</a></div>
</div>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.AddDocument(System.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1443">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_AddDocument_" data-uid="Lucene.Net.Index.IndexWriter.AddDocument*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__" data-uid="Lucene.Net.Index.IndexWriter.AddDocument(System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField})">AddDocument(IEnumerable&lt;IIndexableField&gt;)</h4>
<div class="markdown level1 summary"><p>Adds a document to this index.</p>
<p> Note that if an <span class="xref">System.Exception</span> is hit (for example disk full)
then the index will be consistent, but this document
may not have been added. Furthermore, it&apos;s possible
the index will have one segment in non-compound format
even when using compound files (when a merge has
partially succeeded).</p>
<p>This method periodically flushes pending documents
to the <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Directory">Directory</a> (see <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>), and
also periodically triggers segment merges in the index
according to the <a class="xref" href="Lucene.Net.Index.MergePolicy.html">MergePolicy</a> in use.</p>
<p>Merges temporarily consume space in the
directory. The amount of space required is up to 1X the
size of all segments being merged, when no
readers/searchers are open against the index, and up to
2X the size of all segments being merged when
readers/searchers are open against the index (see
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_">ForceMerge(Int32)</a> for details). The sequence of
primitive merge operations performed is governed by the
merge policy.</p>
<p>Note that each term in the document can be no longer
than <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_MAX_TERM_LENGTH">MAX_TERM_LENGTH</a> in bytes, otherwise an
<span class="xref">System.ArgumentException</span> will be thrown.</p>
<p>Note that it&apos;s possible to create an invalid Unicode
string in java if a UTF16 surrogate pair is malformed.
In this case, the invalid characters are silently
replaced with the Unicode replacement character
U+FFFD.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void AddDocument(IEnumerable&lt;IIndexableField&gt; doc)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;</td>
<td><span class="parametername">doc</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__Lucene_Net_Analysis_Analyzer_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.AddDocument(System.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D%2CLucene.Net.Analysis.Analyzer)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1462">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_AddDocument_" data-uid="Lucene.Net.Index.IndexWriter.AddDocument*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__Lucene_Net_Analysis_Analyzer_" data-uid="Lucene.Net.Index.IndexWriter.AddDocument(System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField},Lucene.Net.Analysis.Analyzer)">AddDocument(IEnumerable&lt;IIndexableField&gt;, Analyzer)</h4>
<div class="markdown level1 summary"><p>Adds a document to this index, using the provided <code data-dev-comment-type="paramref" class="paramref">analyzer</code> instead of the
value of <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Analyzer">Analyzer</a>.</p>
<p>See <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__">AddDocument(IEnumerable&lt;IIndexableField&gt;)</a> for details on
index and <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> state after an <span class="xref">System.Exception</span>, and
flushing/merging temporary free space requirements.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void AddDocument(IEnumerable&lt;IIndexableField&gt; doc, Analyzer analyzer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;</td>
<td><span class="parametername">doc</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Analysis.Analyzer.html">Analyzer</a></td>
<td><span class="parametername">analyzer</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_AddDocuments_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.AddDocuments(System.Collections.Generic.IEnumerable%7BSystem.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1507">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_AddDocuments_" data-uid="Lucene.Net.Index.IndexWriter.AddDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_AddDocuments_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___" data-uid="Lucene.Net.Index.IndexWriter.AddDocuments(System.Collections.Generic.IEnumerable{System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField}})">AddDocuments(IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt;)</h4>
<div class="markdown level1 summary"><p>Atomically adds a block of documents with sequentially
assigned document IDs, such that an external reader
will see all or none of the documents.</p>
<p><strong>WARNING</strong>: the index does not currently record
which documents were added as a block. Today this is
fine, because merging will preserve a block. The order of
documents within a segment will be preserved, even when child
documents within a block are deleted. Most search features
(like result grouping and block joining) require you to
mark documents; when these documents are deleted these
search features will not work as expected. Obviously adding
documents to an existing block will require you the reindex
the entire block.</p>
<p>However it&apos;s possible that in the future Lucene may
merge more aggressively re-order documents (for example,
perhaps to obtain better index compression), in which case
you may need to fully re-index your documents at that time.</p>
<p>See <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddDocument_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__">AddDocument(IEnumerable&lt;IIndexableField&gt;)</a> for details on
index and <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> state after an <span class="xref">System.Exception</span>, and
flushing/merging temporary free space requirements.</p>
<p><strong>NOTE</strong>: tools that do offline splitting of an index
(for example, IndexSplitter in Lucene.Net.Misc) or
re-sorting of documents (for example, IndexSorter in
contrib) are not aware of these atomically added documents
and will likely break them up. Use such tools at your
own risk!</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div><p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void AddDocuments(IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt; docs)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;&gt;</td>
<td><span class="parametername">docs</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_AddDocuments_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___Lucene_Net_Analysis_Analyzer_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.AddDocuments(System.Collections.Generic.IEnumerable%7BSystem.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D%7D%2CLucene.Net.Analysis.Analyzer)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1522">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_AddDocuments_" data-uid="Lucene.Net.Index.IndexWriter.AddDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_AddDocuments_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___Lucene_Net_Analysis_Analyzer_" data-uid="Lucene.Net.Index.IndexWriter.AddDocuments(System.Collections.Generic.IEnumerable{System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField}},Lucene.Net.Analysis.Analyzer)">AddDocuments(IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt;, Analyzer)</h4>
<div class="markdown level1 summary"><p>Atomically adds a block of documents, analyzed using the
provided <code data-dev-comment-type="paramref" class="paramref">analyzer</code>, with sequentially assigned document
IDs, such that an external reader will see all or none
of the documents.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void AddDocuments(IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt; docs, Analyzer analyzer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;&gt;</td>
<td><span class="parametername">docs</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Analysis.Analyzer.html">Analyzer</a></td>
<td><span class="parametername">analyzer</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Index_IndexReader___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.AddIndexes(Lucene.Net.Index.IndexReader%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3191">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_AddIndexes_" data-uid="Lucene.Net.Index.IndexWriter.AddIndexes*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Index_IndexReader___" data-uid="Lucene.Net.Index.IndexWriter.AddIndexes(Lucene.Net.Index.IndexReader[])">AddIndexes(IndexReader[])</h4>
<div class="markdown level1 summary"><p>Merges the provided indexes into this index.</p>
<p><p>
The provided <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a>s are not closed.</p>
<p><p>
See <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Index_IndexReader___">AddIndexes(IndexReader[])</a> for details on transactional semantics, temporary
free space required in the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>, and non-CFS segments on an <span class="xref">System.Exception</span>.</p>
<p><p>
<strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span> you should immediately
dispose the writer. See <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
<p><p>
<strong>NOTE:</strong> empty segments are dropped by this method and not added to this
index.</p>
<p><p>
<strong>NOTE:</strong> this method merges all given <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a>s in one
merge. If you intend to merge a large number of readers, it may be better
to call this method multiple times, each time with a small set of readers.
In principle, if you use a merge policy with a <code>mergeFactor</code> or
<code>maxMergeAtOnce</code> parameter, you should pass that many readers in one
call. Also, if the given readers are <a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a>s, they can be
opened with <code>termIndexInterval=-1</code> to save RAM, since during merge
the in-memory structure is not used. See
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_System_Int32_">Open(Directory, Int32)</a>.</p>
<p><p>
<strong>NOTE</strong>: if you call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose_System_Boolean_">Dispose(Boolean)</a> with <code>false</code>, which
aborts all running merges, then any thread still running this method might
hit a <a class="xref" href="Lucene.Net.Index.MergePolicy.MergeAbortedException.html">MergePolicy.MergeAbortedException</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void AddIndexes(params IndexReader[] readers)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a>[]</td>
<td><span class="parametername">readers</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Store_Directory___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.AddIndexes(Lucene.Net.Store.Directory%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3027">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_AddIndexes_" data-uid="Lucene.Net.Index.IndexWriter.AddIndexes*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Store_Directory___" data-uid="Lucene.Net.Index.IndexWriter.AddIndexes(Lucene.Net.Store.Directory[])">AddIndexes(Directory[])</h4>
<div class="markdown level1 summary"><p>Adds all segments from an array of indexes into this index.</p>
<p><p>This may be used to parallelize batch indexing. A large document
collection can be broken into sub-collections. Each sub-collection can be
indexed in parallel, on a different thread, process or machine. The
complete index can then be created by merging sub-collection indexes
with this method.</p>
<p><p>
<strong>NOTE:</strong> this method acquires the write lock in
each directory, to ensure that no <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>
is currently open or tries to open while this is
running.</p>
<p><p>This method is transactional in how <span class="xref">System.Exception</span>s are
handled: it does not commit a new segments_N file until
all indexes are added. this means if an <span class="xref">System.Exception</span>
occurs (for example disk full), then either no indexes
will have been added or they all will have been.</p>
<p><p>Note that this requires temporary free space in the
<a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a> up to 2X the sum of all input indexes
(including the starting index). If readers/searchers
are open against the starting index, then temporary
free space required will be higher by the size of the
starting index (see <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_">ForceMerge(Int32)</a> for details).</p>
<p><p>
<strong>NOTE:</strong> this method only copies the segments of the incoming indexes
and does not merge them. Therefore deleted documents are not removed and
the new segments are not merged with the existing ones.</p>
<p><p>This requires this index not be among those to be added.</p>
<p><p>
<strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void AddIndexes(params Directory[] dirs)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>[]</td>
<td><span class="parametername">dirs</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Store.LockObtainFailedException.html">LockObtainFailedException</a></td>
<td><p>if we were unable to
acquire the write lock in at least one directory </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Commit.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Commit%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3707">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Commit_" data-uid="Lucene.Net.Index.IndexWriter.Commit*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Commit" data-uid="Lucene.Net.Index.IndexWriter.Commit">Commit()</h4>
<div class="markdown level1 summary"><p>Commits all pending changes (added &amp; deleted
documents, segment merges, added
indexes, etc.) to the index, and syncs all referenced
index files, such that a reader will see the changes
and the index updates will survive an OS or machine
crash or power loss. Note that this does not wait for
any running background merges to finish. This may be a
costly operation, so you should test the cost in your
application and do it only when really necessary.</p>
<p> Note that this operation calls <a class="xref" href="Lucene.Net.Store.Directory.html#Lucene_Net_Store_Directory_Sync_System_Collections_Generic_ICollection_System_String__">Sync(ICollection&lt;String&gt;)</a> on
the index files. That call should not return until the
file contents &amp; metadata are on stable storage. For
<a class="xref" href="Lucene.Net.Store.FSDirectory.html">FSDirectory</a>, this calls the OS&apos;s fsync. But, beware:
some hardware devices may in fact cache writes even
during fsync, and return before the bits are actually
on stable storage, to give the appearance of faster
performance. If you have such a device, and it does
not have a battery backup (for example) then on power
loss it may still lose data. Lucene cannot guarantee
consistency on such devices. </p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void Commit()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DeleteAll.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DeleteAll%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2658">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DeleteAll_" data-uid="Lucene.Net.Index.IndexWriter.DeleteAll*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DeleteAll" data-uid="Lucene.Net.Index.IndexWriter.DeleteAll">DeleteAll()</h4>
<div class="markdown level1 summary"><p>Delete all documents in the index.</p>
<p>This method will drop all buffered documents and will
remove all segments from the index. This change will not be
visible until a <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> has been called. This method
can be rolled back using <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Rollback">Rollback()</a>.</p>
<p>NOTE: this method is much faster than using <code>DeleteDocuments(new MatchAllDocsQuery())</code>.
Yet, this method also has different semantics compared to <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query_">DeleteDocuments(Query)</a>
/ <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query___">DeleteDocuments(Query[])</a> since internal data-structures are cleared as well
as all segment information is forcefully dropped anti-viral semantics like omitting norms
are reset or doc value types are cleared. Essentially a call to <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_DeleteAll">DeleteAll()</a> is equivalent
to creating a new <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> with <a class="xref" href="Lucene.Net.Index.OpenMode.html#Lucene_Net_Index_OpenMode_CREATE">CREATE</a> which a delete query only marks
documents as deleted.</p>
<p>NOTE: this method will forcefully abort all merges
in progress. If other threads are running
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_">ForceMerge(Int32)</a>, <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddIndexes_Lucene_Net_Index_IndexReader___">AddIndexes(IndexReader[])</a> or
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMergeDeletes">ForceMergeDeletes()</a> methods, they may receive
<a class="xref" href="Lucene.Net.Index.MergePolicy.MergeAbortedException.html">MergePolicy.MergeAbortedException</a>s.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void DeleteAll()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Index_Term_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Index.Term)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1596">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DeleteDocuments_" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Index_Term_" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Index.Term)">DeleteDocuments(Term)</h4>
<div class="markdown level1 summary"><p>Deletes the document(s) containing <code data-dev-comment-type="paramref" class="paramref">term</code>.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void DeleteDocuments(Term term)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">term</span></td>
<td><p>the term to identify the documents to be deleted </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Index_Term___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Index.Term%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1720">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DeleteDocuments_" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Index_Term___" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Index.Term[])">DeleteDocuments(Term[])</h4>
<div class="markdown level1 summary"><p>Deletes the document(s) containing any of the
terms. All given deletes are applied and flushed atomically
at the same time.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void DeleteDocuments(params Term[] terms)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a>[]</td>
<td><span class="parametername">terms</span></td>
<td><p>array of terms to identify the documents
to be deleted </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Search.Query)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1746">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DeleteDocuments_" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query_" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Search.Query)">DeleteDocuments(Query)</h4>
<div class="markdown level1 summary"><p>Deletes the document(s) matching the provided query.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void DeleteDocuments(Query query)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Search.Query.html">Query</a></td>
<td><span class="parametername">query</span></td>
<td><p>the query to identify the documents to be deleted </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Search.Query%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1774">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DeleteDocuments_" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Search_Query___" data-uid="Lucene.Net.Index.IndexWriter.DeleteDocuments(Lucene.Net.Search.Query[])">DeleteDocuments(Query[])</h4>
<div class="markdown level1 summary"><p>Deletes the document(s) matching any of the provided queries.
All given deletes are applied and flushed atomically at the same time.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void DeleteDocuments(params Query[] queries)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Search.Query.html">Query</a>[]</td>
<td><span class="parametername">queries</span></td>
<td><p>array of queries to identify the documents
to be deleted </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DeleteUnusedFiles.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DeleteUnusedFiles%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5689">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DeleteUnusedFiles_" data-uid="Lucene.Net.Index.IndexWriter.DeleteUnusedFiles*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DeleteUnusedFiles" data-uid="Lucene.Net.Index.IndexWriter.DeleteUnusedFiles">DeleteUnusedFiles()</h4>
<div class="markdown level1 summary"><p>Expert: remove any index files that are no longer
used.</p>
<p> <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> normally deletes unused files itself,
during indexing. However, on Windows, which disallows
deletion of open files, if there is a reader open on
the index then those files cannot be deleted. This is
fine, because <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> will periodically retry
the deletion.</p>
<p> However, <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> doesn&apos;t try that often: only
on open, close, flushing a new segment, and finishing
a merge. If you don&apos;t do any of these actions with your
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>, you&apos;ll see the unused files linger. If
that&apos;s a problem, call this method to delete them
(once you&apos;ve closed the open readers that were
preventing their deletion).</p>
<p> In addition, you can call this method to delete
unreferenced index commits. this might be useful if you
are using an <a class="xref" href="Lucene.Net.Index.IndexDeletionPolicy.html">IndexDeletionPolicy</a> which holds
onto index commits until some criteria are met, but those
commits are no longer needed. Otherwise, those commits will
be deleted the next time <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> is called.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void DeleteUnusedFiles()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Dispose.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Dispose%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1050">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Dispose_" data-uid="Lucene.Net.Index.IndexWriter.Dispose*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Dispose" data-uid="Lucene.Net.Index.IndexWriter.Dispose">Dispose()</h4>
<div class="markdown level1 summary"><p>Commits all changes to an index, waits for pending merges
to complete, and closes all associated files.
<p>
This is a &quot;slow graceful shutdown&quot; which may take a long time
especially if a big merge is pending: If you only want to close
resources use <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Rollback">Rollback()</a>. If you only want to commit
pending changes and close resources see <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose_System_Boolean_">Dispose(Boolean)</a>.
<p>
Note that this may be a costly
operation, so, try to re-use a single writer instead of
closing and opening a new one. See <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> for
caveats about write caching done by some IO devices.</p>
<p> If an <span class="xref">System.Exception</span> is hit during close, eg due to disk
full or some other reason, then both the on-disk index
and the internal state of the <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> instance will
be consistent. However, the close will not be complete
even though part of it (flushing buffered documents)
may have succeeded, so the write lock will still be
held.</p>
<p> If you can correct the underlying cause (eg free up
some disk space) then you can call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose">Dispose()</a> again.
Failing that, if you want to force the write lock to be
released (dangerous, because you may then lose buffered
docs in the <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> instance) then you can do
something like this:</p>
<pre><code>try
{
writer.Dispose();
}
finally
{
if (IndexWriter.IsLocked(directory))
{
IndexWriter.Unlock(directory);
}
}</code></pre>
<p>after which, you must be certain not to use the writer
instance anymore.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer, again. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void Dispose()</code></pre>
</div>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Dispose_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Dispose(System.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1079">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Dispose_" data-uid="Lucene.Net.Index.IndexWriter.Dispose*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Dispose_System_Boolean_" data-uid="Lucene.Net.Index.IndexWriter.Dispose(System.Boolean)">Dispose(Boolean)</h4>
<div class="markdown level1 summary"><p>Closes the index with or without waiting for currently
running merges to finish. This is only meaningful when
using a <a class="xref" href="Lucene.Net.Index.MergeScheduler.html">MergeScheduler</a> that runs merges in background
threads.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer, again. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
<p><strong>NOTE</strong>: it is dangerous to always call
<code>Dispose(false)</code>, especially when <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> is not open
for very long, because this can result in &quot;merge
starvation&quot; whereby long merges will never have a
chance to finish. This will cause too many segments in
your index over time.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void Dispose(bool waitForMerges)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">waitForMerges</span></td>
<td><p>if <code>true</code>, this call will block
until all merges complete; else, it will ask all
running merges to abort, wait until those merges have
finished (which should be at most a few seconds), and
then return. </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DoAfterFlush.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DoAfterFlush%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3482">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DoAfterFlush_" data-uid="Lucene.Net.Index.IndexWriter.DoAfterFlush*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DoAfterFlush" data-uid="Lucene.Net.Index.IndexWriter.DoAfterFlush">DoAfterFlush()</h4>
<div class="markdown level1 summary"><p>A hook for extending classes to execute operations after pending added and
deleted documents have been flushed to the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a> but before the change
is committed (new segments_N file written).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual void DoAfterFlush()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_DoBeforeFlush.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.DoBeforeFlush%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3490">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_DoBeforeFlush_" data-uid="Lucene.Net.Index.IndexWriter.DoBeforeFlush*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_DoBeforeFlush" data-uid="Lucene.Net.Index.IndexWriter.DoBeforeFlush">DoBeforeFlush()</h4>
<div class="markdown level1 summary"><p>A hook for extending classes to execute operations before pending added and
deleted documents are flushed to the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual void DoBeforeFlush()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_EnsureOpen.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.EnsureOpen%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L786">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_EnsureOpen_" data-uid="Lucene.Net.Index.IndexWriter.EnsureOpen*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_EnsureOpen" data-uid="Lucene.Net.Index.IndexWriter.EnsureOpen">EnsureOpen()</h4>
<div class="markdown level1 summary"><p>Used internally to throw an
<span class="xref">System.ObjectDisposedException</span> if this <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> has been
disposed (<code>closed=true</code>) or is in the process of
disposing (<code>closing=true</code>).
<p>
Calls <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_EnsureOpen_System_Boolean_">EnsureOpen(Boolean)</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected void EnsureOpen()</code></pre>
</div>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.ObjectDisposedException</span></td>
<td><p>if this <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> is disposed </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_EnsureOpen_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.EnsureOpen(System.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L769">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_EnsureOpen_" data-uid="Lucene.Net.Index.IndexWriter.EnsureOpen*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_EnsureOpen_System_Boolean_" data-uid="Lucene.Net.Index.IndexWriter.EnsureOpen(System.Boolean)">EnsureOpen(Boolean)</h4>
<div class="markdown level1 summary"><p>Used internally to throw an <span class="xref">System.ObjectDisposedException</span> if this
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> has been disposed or is in the process of diposing.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected void EnsureOpen(bool failIfDisposing)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">failIfDisposing</span></td>
<td><p>if <code>true</code>, also fail when <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> is in the process of
disposing (<code>closing=true</code>) but not yet done disposing (
<code>closed=false</code>) </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.ObjectDisposedException</span></td>
<td><p>if this IndexWriter is closed or in the process of closing </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Flush_System_Boolean_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Flush(System.Boolean%2CSystem.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3832">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Flush_" data-uid="Lucene.Net.Index.IndexWriter.Flush*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Flush_System_Boolean_System_Boolean_" data-uid="Lucene.Net.Index.IndexWriter.Flush(System.Boolean,System.Boolean)">Flush(Boolean, Boolean)</h4>
<div class="markdown level1 summary"><p>Flush all in-memory buffered updates (adds and deletes)
to the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void Flush(bool triggerMerge, bool applyAllDeletes)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">triggerMerge</span></td>
<td><p>if <code>true</code>, we may merge segments (if
deletes or docs were flushed) if necessary </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">applyAllDeletes</span></td>
<td><p>whether pending deletes should also </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.ForceMerge(System.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2091">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_ForceMerge_" data-uid="Lucene.Net.Index.IndexWriter.ForceMerge*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_" data-uid="Lucene.Net.Index.IndexWriter.ForceMerge(System.Int32)">ForceMerge(Int32)</h4>
<div class="markdown level1 summary"><p>Forces merge policy to merge segments until there are &lt;=
<code data-dev-comment-type="paramref" class="paramref">maxNumSegments</code>. The actual merges to be
executed are determined by the <a class="xref" href="Lucene.Net.Index.MergePolicy.html">MergePolicy</a>.</p>
<p>This is a horribly costly operation, especially when
you pass a small <code data-dev-comment-type="paramref" class="paramref">maxNumSegments</code>; usually you
should only call this if the index is static (will no
longer be changed).</p>
<p>Note that this requires up to 2X the index size free
space in your Directory (3X if you&apos;re using compound
file format). For example, if your index size is 10 MB
then you need up to 20 MB free for this to complete (30
MB if you&apos;re using compound file format). Also,
it&apos;s best to call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> afterwards,
to allow <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> to free up disk space.</p>
<p>If some but not all readers re-open while merging
is underway, this will cause &gt; 2X temporary
space to be consumed as those new readers will then
hold open the temporary segments at that time. It is
best not to re-open readers while merging is running.</p>
<p>The actual temporary usage could be much less than
these figures (it depends on many factors).</p>
<p>In general, once this completes, the total size of the
index will be less than the size of the starting index.
It could be quite a bit smaller (if there were many
pending deletes) or just slightly smaller.</p>
<p>If an <span class="xref">System.Exception</span> is hit, for example
due to disk full, the index will not be corrupted and no
documents will be lost. However, it may have
been partially merged (some segments were merged but
not all), and it&apos;s possible that one of the segments in
the index will be in non-compound format even when
using compound file format. This will occur when the
<span class="xref">System.Exception</span> is hit during conversion of the segment into
compound format.</p>
<p>This call will merge those segments present in
the index when the call started. If other threads are
still adding documents and flushing segments, those
newly created segments will not be merged unless you
call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_">ForceMerge(Int32)</a> again.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
<p><strong>NOTE</strong>: if you call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose_System_Boolean_">Dispose(Boolean)</a>
with <code>false</code>, which aborts all running merges,
then any thread still running this method might hit a
<a class="xref" href="Lucene.Net.Index.MergePolicy.MergeAbortedException.html">MergePolicy.MergeAbortedException</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void ForceMerge(int maxNumSegments)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxNumSegments</span></td>
<td><p>maximum number of segments left
in the index after merging finishes</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32__seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.MergePolicy.html#Lucene_Net_Index_MergePolicy_FindMerges_Lucene_Net_Index_MergeTrigger_Lucene_Net_Index_SegmentInfos_">FindMerges</a>(<a class="xref" href="Lucene.Net.Index.MergeTrigger.html">MergeTrigger</a>, <a class="xref" href="Lucene.Net.Index.SegmentInfos.html">SegmentInfos</a>)</div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.ForceMerge(System.Int32%2CSystem.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2107">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_ForceMerge_" data-uid="Lucene.Net.Index.IndexWriter.ForceMerge*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_System_Boolean_" data-uid="Lucene.Net.Index.IndexWriter.ForceMerge(System.Int32,System.Boolean)">ForceMerge(Int32, Boolean)</h4>
<div class="markdown level1 summary"><p>Just like <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMerge_System_Int32_">ForceMerge(Int32)</a>, except you can
specify whether the call should block until
all merging completes. This is only meaningful with a
<span class="xref">Lucene.Net.Index.IndexWriter.mergeScheduler</span> that is able to run merges in
background threads.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void ForceMerge(int maxNumSegments, bool doWait)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxNumSegments</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">doWait</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_ForceMergeDeletes.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.ForceMergeDeletes%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2348">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_ForceMergeDeletes_" data-uid="Lucene.Net.Index.IndexWriter.ForceMergeDeletes*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_ForceMergeDeletes" data-uid="Lucene.Net.Index.IndexWriter.ForceMergeDeletes">ForceMergeDeletes()</h4>
<div class="markdown level1 summary"><p>Forces merging of all segments that have deleted
documents. The actual merges to be executed are
determined by the <a class="xref" href="Lucene.Net.Index.MergePolicy.html">MergePolicy</a>. For example,
the default <a class="xref" href="Lucene.Net.Index.TieredMergePolicy.html">TieredMergePolicy</a> will only
pick a segment if the percentage of
deleted docs is over 10%.</p>
<p>This is often a horribly costly operation; rarely
is it warranted.</p>
<p>To see how
many deletions you have pending in your index, call
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_NumDeletedDocs">NumDeletedDocs</a>.</p>
<p><strong>NOTE</strong>: this method first flushes a new
segment (if there are indexed documents), and applies
all buffered deletes.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void ForceMergeDeletes()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_ForceMergeDeletes_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.ForceMergeDeletes(System.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2251">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_ForceMergeDeletes_" data-uid="Lucene.Net.Index.IndexWriter.ForceMergeDeletes*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_ForceMergeDeletes_System_Boolean_" data-uid="Lucene.Net.Index.IndexWriter.ForceMergeDeletes(System.Boolean)">ForceMergeDeletes(Boolean)</h4>
<div class="markdown level1 summary"><p>Just like <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_ForceMergeDeletes">ForceMergeDeletes()</a>, except you can
specify whether the call should block until the
operation completes. This is only meaningful with a
<a class="xref" href="Lucene.Net.Index.MergeScheduler.html">MergeScheduler</a> that is able to run merges in
background threads.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
<p><strong>NOTE</strong>: if you call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Dispose_System_Boolean_">Dispose(Boolean)</a>
with <code>false</code>, which aborts all running merges,
then any thread still running this method might hit a
<a class="xref" href="Lucene.Net.Index.MergePolicy.MergeAbortedException.html">MergePolicy.MergeAbortedException</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void ForceMergeDeletes(bool doWait)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">doWait</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_GetReader_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.GetReader(System.Boolean)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L346">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_GetReader_" data-uid="Lucene.Net.Index.IndexWriter.GetReader*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_GetReader_System_Boolean_" data-uid="Lucene.Net.Index.IndexWriter.GetReader(System.Boolean)">GetReader(Boolean)</h4>
<div class="markdown level1 summary"><p>Expert: returns a readonly reader, covering all
committed as well as un-committed changes to the index.
this provides &quot;near real-time&quot; searching, in that
changes made during an <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> session can be
quickly made available for searching without closing
the writer nor calling <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a>.</p>
<p>Note that this is functionally equivalent to calling
Flush() and then opening a new reader. But the turnaround time of this
method should be faster since it avoids the potentially
costly <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a>.</p>
<p>You must close the <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> returned by
this method once you are done using it.</p>
<p>It&apos;s <em>near</em> real-time because there is no hard
guarantee on how quickly you can get a new reader after
making changes with <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>. You&apos;ll have to
experiment in your situation to determine if it&apos;s
fast enough. As this is a new and experimental
feature, please report back on your findings so we can
learn, improve and iterate.</p>
<p>The resulting reader supports
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_DoOpenIfChanged">DoOpenIfChanged()</a>, but that call will simply forward
back to this method (though this may change in the
future).</p>
<p>The very first time this method is called, this
writer instance will make every effort to pool the
readers that it opens for doing merges, applying
deletes, etc. This means additional resources (RAM,
file descriptors, CPU time) will be consumed.</p>
<p>For lower latency on reopening a reader, you should
set <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_MergedSegmentWarmer">MergedSegmentWarmer</a> to
pre-warm a newly merged segment before it&apos;s committed
to the index. This is important for minimizing
index-to-search delay after a large merge. </p>
<p>If an AddIndexes* call is running in another thread,
then this reader will only search those segments from
the foreign index that have been successfully copied
over, so far.</p>
<p><strong>NOTE</strong>: Once the writer is disposed, any
outstanding readers may continue to be used. However,
if you attempt to reopen any of those readers, you&apos;ll
hit an <span class="xref">System.ObjectDisposedException</span>.</p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual DirectoryReader GetReader(bool applyAllDeletes)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">applyAllDeletes</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></td>
<td><p><a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> that covers entire index plus all
changes made so far by this <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> instance</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>If there is a low-level I/O error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_HasDeletions.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.HasDeletions%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1374">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_HasDeletions_" data-uid="Lucene.Net.Index.IndexWriter.HasDeletions*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_HasDeletions" data-uid="Lucene.Net.Index.IndexWriter.HasDeletions">HasDeletions()</h4>
<div class="markdown level1 summary"><p>Returns <code>true</code> if this index has deletions (including
buffered deletions). Note that this will return <code>true</code>
if there are buffered Term/Query deletions, even if it
turns out those buffered deletions don&apos;t match any
documents. Also, if a merge kicked off as a result of flushing a</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual bool HasDeletions()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_HasPendingMerges.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.HasPendingMerges%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2483">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_HasPendingMerges_" data-uid="Lucene.Net.Index.IndexWriter.HasPendingMerges*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_HasPendingMerges" data-uid="Lucene.Net.Index.IndexWriter.HasPendingMerges">HasPendingMerges()</h4>
<div class="markdown level1 summary"><p>Expert: returns true if there are merges waiting to be scheduled.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual bool HasPendingMerges()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_HasUncommittedChanges.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.HasUncommittedChanges%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3724">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_HasUncommittedChanges_" data-uid="Lucene.Net.Index.IndexWriter.HasUncommittedChanges*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_HasUncommittedChanges" data-uid="Lucene.Net.Index.IndexWriter.HasUncommittedChanges">HasUncommittedChanges()</h4>
<div class="markdown level1 summary"><p>Returns <code>true</code> if there may be changes that have not been
committed. There are cases where this may return <code>true</code>
when there are no actual &quot;real&quot; changes to the index,
for example if you&apos;ve deleted by <a class="xref" href="Lucene.Net.Index.Term.html">Term</a> or <a class="xref" href="Lucene.Net.Search.Query.html">Query</a> but
that <a class="xref" href="Lucene.Net.Index.Term.html">Term</a> or <a class="xref" href="Lucene.Net.Search.Query.html">Query</a> does not match any documents.
Also, if a merge kicked off as a result of flushing a
new segment during <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a>, or a concurrent
merged finished, this method may return <code>true</code> right
after you had just called <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public bool HasUncommittedChanges()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_IsLocked_Lucene_Net_Store_Directory_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.IsLocked(Lucene.Net.Store.Directory)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5558">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_IsLocked_" data-uid="Lucene.Net.Index.IndexWriter.IsLocked*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_IsLocked_Lucene_Net_Store_Directory_" data-uid="Lucene.Net.Index.IndexWriter.IsLocked(Lucene.Net.Store.Directory)">IsLocked(Directory)</h4>
<div class="markdown level1 summary"><p>Returns <code>true</code> iff the index in the named directory is
currently locked. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool IsLocked(Directory directory)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a></td>
<td><span class="parametername">directory</span></td>
<td><p>the directory to check for a lock </p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_MaybeMerge.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.MaybeMerge%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2370">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_MaybeMerge_" data-uid="Lucene.Net.Index.IndexWriter.MaybeMerge*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_MaybeMerge" data-uid="Lucene.Net.Index.IndexWriter.MaybeMerge">MaybeMerge()</h4>
<div class="markdown level1 summary"><p>Expert: asks the <span class="xref">Lucene.Net.Index.IndexWriter.mergePolicy</span> whether any merges are
necessary now and if so, runs the requested merges and
then iterate (test again if merges are needed) until no
more merges are returned by the <span class="xref">Lucene.Net.Index.IndexWriter.mergePolicy</span>.
<p>
Explicit calls to <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_MaybeMerge">MaybeMerge()</a> are usually not
necessary. The most common case is when merge policy
parameters have changed.
<p>
this method will call the <span class="xref">Lucene.Net.Index.IndexWriter.mergePolicy</span> with
<a class="xref" href="Lucene.Net.Index.MergeTrigger.html#Lucene_Net_Index_MergeTrigger_EXPLICIT">EXPLICIT</a>.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void MaybeMerge()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Merge_Lucene_Net_Index_MergePolicy_OneMerge_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Merge(Lucene.Net.Index.MergePolicy.OneMerge)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L4534">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Merge_" data-uid="Lucene.Net.Index.IndexWriter.Merge*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Merge_Lucene_Net_Index_MergePolicy_OneMerge_" data-uid="Lucene.Net.Index.IndexWriter.Merge(Lucene.Net.Index.MergePolicy.OneMerge)">Merge(MergePolicy.OneMerge)</h4>
<div class="markdown level1 summary"><p>Merges the indicated segments, replacing them in the stack with a
single segment.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void Merge(MergePolicy.OneMerge merge)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.MergePolicy.OneMerge.html">MergePolicy.OneMerge</a></td>
<td><span class="parametername">merge</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_MergeFinish_Lucene_Net_Index_MergePolicy_OneMerge_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.MergeFinish(Lucene.Net.Index.MergePolicy.OneMerge)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L4863">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_MergeFinish_" data-uid="Lucene.Net.Index.IndexWriter.MergeFinish*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_MergeFinish_Lucene_Net_Index_MergePolicy_OneMerge_" data-uid="Lucene.Net.Index.IndexWriter.MergeFinish(Lucene.Net.Index.MergePolicy.OneMerge)">MergeFinish(MergePolicy.OneMerge)</h4>
<div class="markdown level1 summary"><p>Does fininishing for a merge, which is fast but holds
the synchronized lock on <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> instance.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void MergeFinish(MergePolicy.OneMerge merge)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.MergePolicy.OneMerge.html">MergePolicy.OneMerge</a></td>
<td><span class="parametername">merge</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_NextMerge.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.NextMerge%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2459">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_NextMerge_" data-uid="Lucene.Net.Index.IndexWriter.NextMerge*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_NextMerge" data-uid="Lucene.Net.Index.IndexWriter.NextMerge">NextMerge()</h4>
<div class="markdown level1 summary"><p>Expert: the <span class="xref">Lucene.Net.Index.IndexWriter.mergeScheduler</span> calls this method to retrieve the next
merge requested by the <a class="xref" href="Lucene.Net.Index.MergePolicy.html">MergePolicy</a>
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual MergePolicy.OneMerge NextMerge()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.MergePolicy.OneMerge.html">MergePolicy.OneMerge</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_NumDeletedDocs_Lucene_Net_Index_SegmentCommitInfo_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.NumDeletedDocs(Lucene.Net.Index.SegmentCommitInfo)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L746">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_NumDeletedDocs_" data-uid="Lucene.Net.Index.IndexWriter.NumDeletedDocs*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_NumDeletedDocs_Lucene_Net_Index_SegmentCommitInfo_" data-uid="Lucene.Net.Index.IndexWriter.NumDeletedDocs(Lucene.Net.Index.SegmentCommitInfo)">NumDeletedDocs(SegmentCommitInfo)</h4>
<div class="markdown level1 summary"><p>Obtain the number of deleted docs for a pooled reader.
If the reader isn&apos;t being pooled, the segmentInfo&apos;s
delCount is returned.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual int NumDeletedDocs(SegmentCommitInfo info)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.SegmentCommitInfo.html">SegmentCommitInfo</a></td>
<td><span class="parametername">info</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_NumRamDocs.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.NumRamDocs%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3996">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_NumRamDocs_" data-uid="Lucene.Net.Index.IndexWriter.NumRamDocs*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_NumRamDocs" data-uid="Lucene.Net.Index.IndexWriter.NumRamDocs">NumRamDocs()</h4>
<div class="markdown level1 summary"><p>Expert: Return the number of documents currently
buffered in RAM.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public int NumRamDocs()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_PrepareCommit.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.PrepareCommit%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3513">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_PrepareCommit_" data-uid="Lucene.Net.Index.IndexWriter.PrepareCommit*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_PrepareCommit" data-uid="Lucene.Net.Index.IndexWriter.PrepareCommit">PrepareCommit()</h4>
<div class="markdown level1 summary"><p>Expert: prepare for commit. This does the
first phase of 2-phase commit. this method does all
steps necessary to commit changes since this writer
was opened: flushes pending added and deleted docs,
syncs the index files, writes most of next segments_N
file. After calling this you must call either
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> to finish the commit, or
<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Rollback">Rollback()</a> to revert the commit and undo all changes
done since the writer was opened.</p>
<p>You can also just call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> directly
without <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_PrepareCommit">PrepareCommit()</a> first in which case that method
will internally call <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_PrepareCommit">PrepareCommit()</a>.</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void PrepareCommit()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_RamSizeInBytes.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.RamSizeInBytes%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3973">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_RamSizeInBytes_" data-uid="Lucene.Net.Index.IndexWriter.RamSizeInBytes*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_RamSizeInBytes" data-uid="Lucene.Net.Index.IndexWriter.RamSizeInBytes">RamSizeInBytes()</h4>
<div class="markdown level1 summary"><p>Expert: Return the total size of all index files currently cached in memory.
Useful for size management with flushRamDocs()</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public long RamSizeInBytes()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Rollback.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Rollback%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2502">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Rollback_" data-uid="Lucene.Net.Index.IndexWriter.Rollback*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Rollback" data-uid="Lucene.Net.Index.IndexWriter.Rollback">Rollback()</h4>
<div class="markdown level1 summary"><p>Close the <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> without committing
any changes that have occurred since the last commit
(or since it was opened, if commit hasn&apos;t been called).
this removes any temporary files that had been created,
after which the state of the index will be the same as
it was when <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> was last called or when this
writer was first opened. This also clears a previous
call to <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_PrepareCommit">PrepareCommit()</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void Rollback()</code></pre>
</div>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SegString.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SegString%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5293">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_SegString_" data-uid="Lucene.Net.Index.IndexWriter.SegString*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_SegString" data-uid="Lucene.Net.Index.IndexWriter.SegString">SegString()</h4>
<div class="markdown level1 summary"><p>Returns a string description of all segments, for
debugging.
<p>
<div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual string SegString()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SegString_Lucene_Net_Index_SegmentCommitInfo_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SegString(Lucene.Net.Index.SegmentCommitInfo)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5330">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_SegString_" data-uid="Lucene.Net.Index.IndexWriter.SegString*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_SegString_Lucene_Net_Index_SegmentCommitInfo_" data-uid="Lucene.Net.Index.IndexWriter.SegString(Lucene.Net.Index.SegmentCommitInfo)">SegString(SegmentCommitInfo)</h4>
<div class="markdown level1 summary"><p>Returns a string description of the specified
segment, for debugging.
<p>
<div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual string SegString(SegmentCommitInfo info)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.SegmentCommitInfo.html">SegmentCommitInfo</a></td>
<td><span class="parametername">info</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SegString_System_Collections_Generic_IEnumerable_Lucene_Net_Index_SegmentCommitInfo__.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SegString(System.Collections.Generic.IEnumerable%7BLucene.Net.Index.SegmentCommitInfo%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5307">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_SegString_" data-uid="Lucene.Net.Index.IndexWriter.SegString*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_SegString_System_Collections_Generic_IEnumerable_Lucene_Net_Index_SegmentCommitInfo__" data-uid="Lucene.Net.Index.IndexWriter.SegString(System.Collections.Generic.IEnumerable{Lucene.Net.Index.SegmentCommitInfo})">SegString(IEnumerable&lt;SegmentCommitInfo&gt;)</h4>
<div class="markdown level1 summary"><p>Returns a string description of the specified
segments, for debugging.
<p>
<div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual string SegString(IEnumerable&lt;SegmentCommitInfo&gt; infos)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.SegmentCommitInfo.html">SegmentCommitInfo</a>&gt;</td>
<td><span class="parametername">infos</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_SetCommitData_System_Collections_Generic_IDictionary_System_String_System_String__.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.SetCommitData(System.Collections.Generic.IDictionary%7BSystem.String%2CSystem.String%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L3650">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_SetCommitData_" data-uid="Lucene.Net.Index.IndexWriter.SetCommitData*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_SetCommitData_System_Collections_Generic_IDictionary_System_String_System_String__" data-uid="Lucene.Net.Index.IndexWriter.SetCommitData(System.Collections.Generic.IDictionary{System.String,System.String})">SetCommitData(IDictionary&lt;String, String&gt;)</h4>
<div class="markdown level1 summary"><p>Sets the commit user data map. That method is considered a transaction by
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> and will be committed (<a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> even if no other
changes were made to the writer instance. Note that you must call this method
before <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_PrepareCommit">PrepareCommit()</a>, or otherwise it won&apos;t be included in the
follow-on <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a>.
<p>
<strong>NOTE:</strong> the dictionary is cloned internally, therefore altering the dictionary&apos;s
contents after calling this method has no effect.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void SetCommitData(IDictionary&lt;string, string&gt; commitUserData)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IDictionary</span>&lt;<span class="xref">System.String</span>, <span class="xref">System.String</span>&gt;</td>
<td><span class="parametername">commitUserData</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_TryDeleteDocument_Lucene_Net_Index_IndexReader_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.TryDeleteDocument(Lucene.Net.Index.IndexReader%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1628">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_TryDeleteDocument_" data-uid="Lucene.Net.Index.IndexWriter.TryDeleteDocument*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_TryDeleteDocument_Lucene_Net_Index_IndexReader_System_Int32_" data-uid="Lucene.Net.Index.IndexWriter.TryDeleteDocument(Lucene.Net.Index.IndexReader,System.Int32)">TryDeleteDocument(IndexReader, Int32)</h4>
<div class="markdown level1 summary"><p>Expert: attempts to delete by document ID, as long as
the provided <code data-dev-comment-type="paramref" class="paramref">readerIn</code> is a near-real-time reader (from
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexWriter_System_Boolean_">Open(IndexWriter, Boolean)</a>. If the
provided <code data-dev-comment-type="paramref" class="paramref">readerIn</code> is an NRT reader obtained from this
writer, and its segment has not been merged away, then
the delete succeeds and this method returns <code>true</code>; else, it
returns <code>false</code> the caller must then separately delete by
Term or Query.</p>
<p><strong>NOTE</strong>: this method can only delete documents
visible to the currently open NRT reader. If you need
to delete documents indexed after opening the NRT
reader you must use the other DeleteDocument() methods
(e.g., <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_DeleteDocuments_Lucene_Net_Index_Term_">DeleteDocuments(Term)</a>).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual bool TryDeleteDocument(IndexReader readerIn, int docID)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a></td>
<td><span class="parametername">readerIn</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">docID</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_Unlock_Lucene_Net_Store_Directory_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.Unlock(Lucene.Net.Store.Directory)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L5570">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_Unlock_" data-uid="Lucene.Net.Index.IndexWriter.Unlock*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_Unlock_Lucene_Net_Store_Directory_" data-uid="Lucene.Net.Index.IndexWriter.Unlock(Lucene.Net.Store.Directory)">Unlock(Directory)</h4>
<div class="markdown level1 summary"><p>Forcibly unlocks the index in the named directory.
<p>
Caution: this should only be used by failure recovery code,
when it is known that no other process nor thread is in fact
currently accessing this index.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void Unlock(Directory directory)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a></td>
<td><span class="parametername">directory</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_UpdateBinaryDocValue_Lucene_Net_Index_Term_System_String_Lucene_Net_Util_BytesRef_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.UpdateBinaryDocValue(Lucene.Net.Index.Term%2CSystem.String%2CLucene.Net.Util.BytesRef)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1928">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_UpdateBinaryDocValue_" data-uid="Lucene.Net.Index.IndexWriter.UpdateBinaryDocValue*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_UpdateBinaryDocValue_Lucene_Net_Index_Term_System_String_Lucene_Net_Util_BytesRef_" data-uid="Lucene.Net.Index.IndexWriter.UpdateBinaryDocValue(Lucene.Net.Index.Term,System.String,Lucene.Net.Util.BytesRef)">UpdateBinaryDocValue(Term, String, BytesRef)</h4>
<div class="markdown level1 summary"><p>Updates a document&apos;s <a class="xref" href="Lucene.Net.Index.BinaryDocValues.html">BinaryDocValues</a> for <code data-dev-comment-type="paramref" class="paramref">field</code> to the
given <code data-dev-comment-type="paramref" class="paramref">value</code>. this method can be used to &apos;unset&apos; a document&apos;s
value by passing <code>null</code> as the new <code data-dev-comment-type="paramref" class="paramref">value</code>. Also, you can only update
fields that already exist in the index, not add new fields through this
method.</p>
<p>
<strong>NOTE:</strong> this method currently replaces the existing value of all
affected documents with the new value.
<p>
<strong>NOTE:</strong> if this method hits an <span class="xref">System.OutOfMemoryException</span> you should immediately
dispose the writer. See <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void UpdateBinaryDocValue(Term term, string field, BytesRef value)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">term</span></td>
<td><p>the term to identify the document(s) to be updated </p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td><p>field name of the <a class="xref" href="Lucene.Net.Index.BinaryDocValues.html">BinaryDocValues</a> field </p>
</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Util.BytesRef.html">BytesRef</a></td>
<td><span class="parametername">value</span></td>
<td><p>new value for the field </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_UpdateDocument_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.UpdateDocument(Lucene.Net.Index.Term%2CSystem.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1806">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_UpdateDocument_" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocument*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_UpdateDocument_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocument(Lucene.Net.Index.Term,System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField})">UpdateDocument(Term, IEnumerable&lt;IIndexableField&gt;)</h4>
<div class="markdown level1 summary"><p>Updates a document by first deleting the document(s)
containing <code data-dev-comment-type="paramref" class="paramref">term</code> and then adding the new
document. The delete and then add are atomic as seen
by a reader on the same index (flush may happen only after
the add).</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void UpdateDocument(Term term, IEnumerable&lt;IIndexableField&gt; doc)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">term</span></td>
<td><p>the term to identify the document(s) to be
deleted </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;</td>
<td><span class="parametername">doc</span></td>
<td><p>the document to be added </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_UpdateDocument_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__Lucene_Net_Analysis_Analyzer_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.UpdateDocument(Lucene.Net.Index.Term%2CSystem.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D%2CLucene.Net.Analysis.Analyzer)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1829">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_UpdateDocument_" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocument*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_UpdateDocument_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField__Lucene_Net_Analysis_Analyzer_" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocument(Lucene.Net.Index.Term,System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField},Lucene.Net.Analysis.Analyzer)">UpdateDocument(Term, IEnumerable&lt;IIndexableField&gt;, Analyzer)</h4>
<div class="markdown level1 summary"><p>Updates a document by first deleting the document(s)
containing <code data-dev-comment-type="paramref" class="paramref">term</code> and then adding the new
document. The delete and then add are atomic as seen
by a reader on the same index (flush may happen only after
the add).</p>
<p><strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span>
you should immediately dispose the writer. See
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void UpdateDocument(Term term, IEnumerable&lt;IIndexableField&gt; doc, Analyzer analyzer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">term</span></td>
<td><p>the term to identify the document(s) to be
deleted </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;</td>
<td><span class="parametername">doc</span></td>
<td><p>the document to be added </p>
</td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Analysis.Analyzer.html">Analyzer</a></td>
<td><span class="parametername">analyzer</span></td>
<td><p>the analyzer to use when analyzing the document </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_UpdateDocuments_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.UpdateDocuments(Lucene.Net.Index.Term%2CSystem.Collections.Generic.IEnumerable%7BSystem.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1538">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_UpdateDocuments_" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_UpdateDocuments_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocuments(Lucene.Net.Index.Term,System.Collections.Generic.IEnumerable{System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField}})">UpdateDocuments(Term, IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt;)</h4>
<div class="markdown level1 summary"><p>Atomically deletes documents matching the provided
<code data-dev-comment-type="paramref" class="paramref">delTerm</code> and adds a block of documents with sequentially
assigned document IDs, such that an external reader
will see all or none of the documents.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void UpdateDocuments(Term delTerm, IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt; docs)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">delTerm</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;&gt;</td>
<td><span class="parametername">docs</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Index_IndexWriter_UpdateDocuments_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField____seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddDocuments_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___">AddDocuments(IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt;)</a></div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_UpdateDocuments_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___Lucene_Net_Analysis_Analyzer_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.UpdateDocuments(Lucene.Net.Index.Term%2CSystem.Collections.Generic.IEnumerable%7BSystem.Collections.Generic.IEnumerable%7BLucene.Net.Index.IIndexableField%7D%7D%2CLucene.Net.Analysis.Analyzer)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1555">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_UpdateDocuments_" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocuments*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_UpdateDocuments_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___Lucene_Net_Analysis_Analyzer_" data-uid="Lucene.Net.Index.IndexWriter.UpdateDocuments(Lucene.Net.Index.Term,System.Collections.Generic.IEnumerable{System.Collections.Generic.IEnumerable{Lucene.Net.Index.IIndexableField}},Lucene.Net.Analysis.Analyzer)">UpdateDocuments(Term, IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt;, Analyzer)</h4>
<div class="markdown level1 summary"><p>Atomically deletes documents matching the provided
<code data-dev-comment-type="paramref" class="paramref">delTerm</code> and adds a block of documents, analyzed using
the provided <code data-dev-comment-type="paramref" class="paramref">analyzer</code>, with sequentially
assigned document IDs, such that an external reader
will see all or none of the documents.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void UpdateDocuments(Term delTerm, IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt; docs, Analyzer analyzer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">delTerm</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<span class="xref">System.Collections.Generic.IEnumerable</span>&lt;<a class="xref" href="Lucene.Net.Index.IIndexableField.html">IIndexableField</a>&gt;&gt;</td>
<td><span class="parametername">docs</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Analysis.Analyzer.html">Analyzer</a></td>
<td><span class="parametername">analyzer</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Index_IndexWriter_UpdateDocuments_Lucene_Net_Index_Term_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___Lucene_Net_Analysis_Analyzer__seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_AddDocuments_System_Collections_Generic_IEnumerable_System_Collections_Generic_IEnumerable_Lucene_Net_Index_IIndexableField___">AddDocuments(IEnumerable&lt;IEnumerable&lt;IIndexableField&gt;&gt;)</a></div>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_UpdateNumericDocValue_Lucene_Net_Index_Term_System_String_System_Nullable_System_Int64__.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.UpdateNumericDocValue(Lucene.Net.Index.Term%2CSystem.String%2CSystem.Nullable%7BSystem.Int64%7D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L1882">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_UpdateNumericDocValue_" data-uid="Lucene.Net.Index.IndexWriter.UpdateNumericDocValue*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_UpdateNumericDocValue_Lucene_Net_Index_Term_System_String_System_Nullable_System_Int64__" data-uid="Lucene.Net.Index.IndexWriter.UpdateNumericDocValue(Lucene.Net.Index.Term,System.String,System.Nullable{System.Int64})">UpdateNumericDocValue(Term, String, Nullable&lt;Int64&gt;)</h4>
<div class="markdown level1 summary"><p>Updates a document&apos;s <a class="xref" href="Lucene.Net.Index.NumericDocValues.html">NumericDocValues</a> for <code data-dev-comment-type="paramref" class="paramref">field</code> to the
given <code data-dev-comment-type="paramref" class="paramref">value</code>. This method can be used to &apos;unset&apos; a document&apos;s
value by passing <code>null</code> as the new <code data-dev-comment-type="paramref" class="paramref">value</code>. Also, you can only update
fields that already exist in the index, not add new fields through this
method.</p>
<p>
<strong>NOTE</strong>: if this method hits an <span class="xref">System.OutOfMemoryException</span> you should immediately
dispose the writer. See <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> for details.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void UpdateNumericDocValue(Term term, string field, long? value)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.Term.html">Term</a></td>
<td><span class="parametername">term</span></td>
<td><p>the term to identify the document(s) to be updated </p>
</td>
</tr>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td><p>field name of the <a class="xref" href="Lucene.Net.Index.NumericDocValues.html">NumericDocValues</a> field </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Nullable</span>&lt;<span class="xref">System.Int64</span>&gt;</td>
<td><span class="parametername">value</span></td>
<td><p>new value for the field </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Index.CorruptIndexException.html">CorruptIndexException</a></td>
<td><p>if the index is corrupt </p>
</td>
</tr>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if there is a low-level IO error </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter_WaitForMerges.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter.WaitForMerges%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L2799">View Source</a>
</span>
<a id="Lucene_Net_Index_IndexWriter_WaitForMerges_" data-uid="Lucene.Net.Index.IndexWriter.WaitForMerges*"></a>
<h4 id="Lucene_Net_Index_IndexWriter_WaitForMerges" data-uid="Lucene.Net.Index.IndexWriter.WaitForMerges">WaitForMerges()</h4>
<div class="markdown level1 summary"><p>Wait for any currently outstanding merges to finish.</p>
<p>It is guaranteed that any merges started prior to calling this method
will have completed once this method completes.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void WaitForMerges()</code></pre>
</div>
<h3 id="implements">Implements</h3>
<div>
<span class="xref">System.IDisposable</span>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.ITwoPhaseCommit.html">ITwoPhaseCommit</a>
</div>
</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/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_IndexWriter.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.IndexWriter%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/apache/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net/Index/IndexWriter.cs/#L184" class="contribution-link">View Source</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 Licensed to the Apache Software Foundation (ASF)
</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>