blob: 15539986b07fcf76dc9676ab6b60c9aa0acf98d4 [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 DirectoryReader
| Apache Lucene.NET 4.8.0-beta00013 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class DirectoryReader
| Apache Lucene.NET 4.8.0-beta00013 Documentation ">
<meta name="generator" content="docfx 2.56.2.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="core/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<span id="forkongithub"><a href="https://github.com/apache/lucenenet" target="_blank">Fork me on GitHub</a></span>
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Index.DirectoryReader">
<h1 id="Lucene_Net_Index_DirectoryReader" data-uid="Lucene.Net.Index.DirectoryReader" class="text-break">Class DirectoryReader
</h1>
<div class="markdown level0 summary"><p><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a> is an implementation of <a class="xref" href="Lucene.Net.Index.CompositeReader.html">CompositeReader</a>
that can read indexes in a <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>.</p>
<p><p><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a> instances are usually constructed with a call to
one of the static <code>Open()</code> methods, e.g. <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_">Open(Directory)</a>.</p>
<p><p> For efficiency, in this API documents are often referred to via
<em>document numbers</em>, non-negative integers which each name a unique
document in the index. These document numbers are ephemeral -- they may change
as documents are added to and deleted from an index. Clients should thus not
rely on a given document having the same number between sessions.</p>
<p><p><strong>NOTE</strong>:
<a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</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.IndexReader.html">IndexReader</a> instance; use your own
(non-Lucene) objects instead.</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"><a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a></div>
<div class="level2"><a class="xref" href="Lucene.Net.Index.CompositeReader.html">CompositeReader</a></div>
<div class="level3"><a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html">BaseCompositeReader</a>&lt;<a class="xref" href="Lucene.Net.Index.AtomicReader.html">AtomicReader</a>&gt;</div>
<div class="level4"><span class="xref">DirectoryReader</span></div>
<div class="level5"><a class="xref" href="Lucene.Net.Index.FilterDirectoryReader.html">FilterDirectoryReader</a></div>
</div>
<div classs="implements">
<h5>Implements</h5>
<div><span class="xref">System.IDisposable</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_GetTermVectors_System_Int32_">BaseCompositeReader&lt;AtomicReader&gt;.GetTermVectors(Int32)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_NumDocs">BaseCompositeReader&lt;AtomicReader&gt;.NumDocs</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_MaxDoc">BaseCompositeReader&lt;AtomicReader&gt;.MaxDoc</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_Document_System_Int32_Lucene_Net_Index_StoredFieldVisitor_">BaseCompositeReader&lt;AtomicReader&gt;.Document(Int32, StoredFieldVisitor)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_DocFreq_Lucene_Net_Index_Term_">BaseCompositeReader&lt;AtomicReader&gt;.DocFreq(Term)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_TotalTermFreq_Lucene_Net_Index_Term_">BaseCompositeReader&lt;AtomicReader&gt;.TotalTermFreq(Term)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_GetSumDocFreq_System_String_">BaseCompositeReader&lt;AtomicReader&gt;.GetSumDocFreq(String)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_GetDocCount_System_String_">BaseCompositeReader&lt;AtomicReader&gt;.GetDocCount(String)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_GetSumTotalTermFreq_System_String_">BaseCompositeReader&lt;AtomicReader&gt;.GetSumTotalTermFreq(String)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_ReaderIndex_System_Int32_">BaseCompositeReader&lt;AtomicReader&gt;.ReaderIndex(Int32)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_ReaderBase_System_Int32_">BaseCompositeReader&lt;AtomicReader&gt;.ReaderBase(Int32)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.BaseCompositeReader-1.html#Lucene_Net_Index_BaseCompositeReader_1_GetSequentialSubReaders">BaseCompositeReader&lt;AtomicReader&gt;.GetSequentialSubReaders()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.CompositeReader.html#Lucene_Net_Index_CompositeReader_ToString">CompositeReader.ToString()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.CompositeReader.html#Lucene_Net_Index_CompositeReader_Context">CompositeReader.Context</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_AddReaderClosedListener_Lucene_Net_Index_IndexReader_IReaderClosedListener_">IndexReader.AddReaderClosedListener(IndexReader.IReaderClosedListener)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_RemoveReaderClosedListener_Lucene_Net_Index_IndexReader_IReaderClosedListener_">IndexReader.RemoveReaderClosedListener(IndexReader.IReaderClosedListener)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_RegisterParentReader_Lucene_Net_Index_IndexReader_">IndexReader.RegisterParentReader(IndexReader)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_RefCount">IndexReader.RefCount</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_IncRef">IndexReader.IncRef()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_TryIncRef">IndexReader.TryIncRef()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_DecRef">IndexReader.DecRef()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_EnsureOpen">IndexReader.EnsureOpen()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_Equals_System_Object_">IndexReader.Equals(Object)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_GetHashCode">IndexReader.GetHashCode()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_GetTermVector_System_Int32_System_String_">IndexReader.GetTermVector(Int32, String)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_NumDeletedDocs">IndexReader.NumDeletedDocs</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_Document_System_Int32_">IndexReader.Document(Int32)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_Document_System_Int32_System_Collections_Generic_ISet_System_String__">IndexReader.Document(Int32, ISet&lt;String&gt;)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_HasDeletions">IndexReader.HasDeletions</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_Dispose">IndexReader.Dispose()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_Dispose_System_Boolean_">IndexReader.Dispose(Boolean)</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_DoClose">IndexReader.DoClose()</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_Leaves">IndexReader.Leaves</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_CoreCacheKey">IndexReader.CoreCacheKey</a>
</div>
<div>
<a class="xref" href="Lucene.Net.Index.IndexReader.html#Lucene_Net_Index_IndexReader_CombinedCoreAndDeletesKey">IndexReader.CombinedCoreAndDeletesKey</a>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</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>
<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_DirectoryReader_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public abstract class DirectoryReader : BaseCompositeReader&lt;AtomicReader&gt;, IDisposable</code></pre>
</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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader__ctor_Lucene_Net_Store_Directory_Lucene_Net_Index_AtomicReader___.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.%23ctor(Lucene.Net.Store.Directory%2CLucene.Net.Index.AtomicReader%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L398">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader__ctor_" data-uid="Lucene.Net.Index.DirectoryReader.#ctor*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader__ctor_Lucene_Net_Store_Directory_Lucene_Net_Index_AtomicReader___" data-uid="Lucene.Net.Index.DirectoryReader.#ctor(Lucene.Net.Store.Directory,Lucene.Net.Index.AtomicReader[])">DirectoryReader(Directory, AtomicReader[])</h4>
<div class="markdown level1 summary"><p>Expert: Constructs a <a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a> on the given <code data-dev-comment-type="paramref" class="paramref">segmentReaders</code>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected DirectoryReader(Directory directory, AtomicReader[] segmentReaders)</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>
<tr>
<td><a class="xref" href="Lucene.Net.Index.AtomicReader.html">AtomicReader</a>[]</td>
<td><span class="parametername">segmentReaders</span></td>
<td><p>the wrapped atomic index segment readers. This array is
returned by <a class="xref" href="Lucene.Net.Index.CompositeReader.html#Lucene_Net_Index_CompositeReader_GetSequentialSubReaders">GetSequentialSubReaders()</a> and used to resolve the correct
subreader for docID-based methods. <strong>Please note:</strong> this array is <strong>not</strong>
cloned and not protected for modification outside of this reader.
Subclasses of <a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a> should take care to not allow
modification of this internal array, e.g. <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_DoOpenIfChanged">DoOpenIfChanged()</a>. </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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_DEFAULT_TERMS_INDEX_DIVISOR.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L53">View Source</a>
</span>
<h4 id="Lucene_Net_Index_DirectoryReader_DEFAULT_TERMS_INDEX_DIVISOR" data-uid="Lucene.Net.Index.DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR">DEFAULT_TERMS_INDEX_DIVISOR</h4>
<div class="markdown level1 summary"><p>Default termInfosIndexDivisor. </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 DEFAULT_TERMS_INDEX_DIVISOR</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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_m_directory.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.m_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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L57">View Source</a>
</span>
<h4 id="Lucene_Net_Index_DirectoryReader_m_directory" data-uid="Lucene.Net.Index.DirectoryReader.m_directory">m_directory</h4>
<div class="markdown level1 summary"><p>The index directory. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected readonly Directory m_directory</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><a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a></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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Directory.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L406">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Directory_" data-uid="Lucene.Net.Index.DirectoryReader.Directory*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Directory" data-uid="Lucene.Net.Index.DirectoryReader.Directory">Directory</h4>
<div class="markdown level1 summary"><p>Returns the directory this index resides in. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public 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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_IndexCommit.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.IndexCommit%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L480">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_IndexCommit_" data-uid="Lucene.Net.Index.DirectoryReader.IndexCommit*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_IndexCommit" data-uid="Lucene.Net.Index.DirectoryReader.IndexCommit">IndexCommit</h4>
<div class="markdown level1 summary"><p>Expert: return the <a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a> that this reader has opened.
<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 abstract IndexCommit IndexCommit { 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.IndexCommit.html">IndexCommit</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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Version.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.Version%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L448">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Version_" data-uid="Lucene.Net.Index.DirectoryReader.Version*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Version" data-uid="Lucene.Net.Index.DirectoryReader.Version">Version</h4>
<div class="markdown level1 summary"><p>Version number when this <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> was opened.</p>
<p>This method
returns the version recorded in the commit that the
reader opened. This version is advanced every time
a change is made with <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public abstract long Version { 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.Int64</span></td>
<td></td>
</tr>
</tbody>
</table>
<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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_DoOpenIfChanged.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.DoOpenIfChanged%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L420">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_" data-uid="Lucene.Net.Index.DirectoryReader.DoOpenIfChanged*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_DoOpenIfChanged" data-uid="Lucene.Net.Index.DirectoryReader.DoOpenIfChanged">DoOpenIfChanged()</h4>
<div class="markdown level1 summary"><p>Implement this method to support <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_">OpenIfChanged(DirectoryReader)</a>.
If this reader does not support reopen, return <code>null</code>, so
client code is happy. This should be consistent with <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_IsCurrent">IsCurrent()</a>
(should always return <code>true</code>) if reopen is not supported. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected abstract DirectoryReader DoOpenIfChanged()</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.DirectoryReader.html">DirectoryReader</a></td>
<td><p><code>null</code> if there are no changes; else, a new
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</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 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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_Lucene_Net_Index_IndexCommit_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.DoOpenIfChanged(Lucene.Net.Index.IndexCommit)%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L429">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_" data-uid="Lucene.Net.Index.DirectoryReader.DoOpenIfChanged*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_Lucene_Net_Index_IndexCommit_" data-uid="Lucene.Net.Index.DirectoryReader.DoOpenIfChanged(Lucene.Net.Index.IndexCommit)">DoOpenIfChanged(IndexCommit)</h4>
<div class="markdown level1 summary"><p>Implement this method to support <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexCommit_">OpenIfChanged(DirectoryReader, IndexCommit)</a>.
If this reader does not support reopen from a specific <a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a>,
throw <span class="xref">System.NotSupportedException</span>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected abstract DirectoryReader DoOpenIfChanged(IndexCommit commit)</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.IndexCommit.html">IndexCommit</a></td>
<td><span class="parametername">commit</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><code>null</code> if there are no changes; else, a new
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</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 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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_Lucene_Net_Index_IndexWriter_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.DoOpenIfChanged(Lucene.Net.Index.IndexWriter%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L438">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_" data-uid="Lucene.Net.Index.DirectoryReader.DoOpenIfChanged*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_DoOpenIfChanged_Lucene_Net_Index_IndexWriter_System_Boolean_" data-uid="Lucene.Net.Index.DirectoryReader.DoOpenIfChanged(Lucene.Net.Index.IndexWriter,System.Boolean)">DoOpenIfChanged(IndexWriter, Boolean)</h4>
<div class="markdown level1 summary"><p>Implement this method to support <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexWriter_System_Boolean_">OpenIfChanged(DirectoryReader, IndexWriter, Boolean)</a>.
If this reader does not support reopen from <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>,
throw <span class="xref">System.NotSupportedException</span>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected abstract DirectoryReader DoOpenIfChanged(IndexWriter writer, 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><a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a></td>
<td><span class="parametername">writer</span></td>
<td></td>
</tr>
<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><code>null</code> if there are no changes; else, a new
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</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 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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_IndexExists_Lucene_Net_Store_Directory_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.IndexExists(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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L348">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_IndexExists_" data-uid="Lucene.Net.Index.DirectoryReader.IndexExists*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_IndexExists_Lucene_Net_Store_Directory_" data-uid="Lucene.Net.Index.DirectoryReader.IndexExists(Lucene.Net.Store.Directory)">IndexExists(Directory)</h4>
<div class="markdown level1 summary"><p>Returns <code>true</code> if an index likely exists at
the specified directory. Note that if a corrupt index
exists, or if an index in the process of committing </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 IndexExists(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 an index </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><p><code>true</code> if an index exists; <code>false</code> otherwise </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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_IsCurrent.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.IsCurrent%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L473">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_IsCurrent_" data-uid="Lucene.Net.Index.DirectoryReader.IsCurrent*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_IsCurrent" data-uid="Lucene.Net.Index.DirectoryReader.IsCurrent">IsCurrent()</h4>
<div class="markdown level1 summary"><p>Check whether any new changes have occurred to the
index since this reader was opened.</p>
<p>If this reader was created by calling an overload of <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_">Open(Directory)</a>,
then this method checks if any further commits
(see <a class="xref" href="Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a>) have occurred in the
directory.</p>
<p>If instead this reader is a near real-time reader
(ie, obtained by a call to
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexWriter_System_Boolean_">Open(IndexWriter, Boolean)</a>, or by calling an overload of <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_">OpenIfChanged(DirectoryReader)</a>
on a near real-time reader), then this method checks if
either a new commit has occurred, or any new
uncommitted changes have taken place via the writer.
Note that even if the writer has only performed
merging, this method will still return <code>false</code>.</p>
<p>In any event, if this returns <code>false</code>, you should call
an overload of <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_">OpenIfChanged(DirectoryReader)</a> to get a new reader that sees the
changes.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public abstract bool IsCurrent()</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>
<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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_ListCommits_Lucene_Net_Store_Directory_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.ListCommits(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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L274">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_ListCommits_" data-uid="Lucene.Net.Index.DirectoryReader.ListCommits*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_ListCommits_Lucene_Net_Store_Directory_" data-uid="Lucene.Net.Index.DirectoryReader.ListCommits(Lucene.Net.Store.Directory)">ListCommits(Directory)</h4>
<div class="markdown level1 summary"><p>Returns all commit points that exist in the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>.
Normally, because the default is
<a class="xref" href="Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy.html">KeepOnlyLastCommitDeletionPolicy</a>, there would be only
one commit point. But if you&apos;re using a custom
<a class="xref" href="Lucene.Net.Index.IndexDeletionPolicy.html">IndexDeletionPolicy</a> then there could be many commits.
Once you have a given commit, you can open a reader on
it by calling <a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexCommit_">Open(IndexCommit)</a>
There must be at least one commit in
the <a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a>, else this method throws
<a class="xref" href="Lucene.Net.Index.IndexNotFoundException.html">IndexNotFoundException</a>. Note that if a commit is in
progress while this method is running, that commit
may or may not be returned.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IList&lt;IndexCommit&gt; ListCommits(Directory dir)</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">dir</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.Collections.Generic.IList</span>&lt;<a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a>&gt;</td>
<td><p>a sorted list of <a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a>s, from oldest
to latest. </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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexCommit_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Index.IndexCommit)%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L120">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Open_" data-uid="Lucene.Net.Index.DirectoryReader.Open*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexCommit_" data-uid="Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Index.IndexCommit)">Open(IndexCommit)</h4>
<div class="markdown level1 summary"><p>Expert: returns an <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> reading the index in the given
<a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</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 DirectoryReader Open(IndexCommit commit)</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.IndexCommit.html">IndexCommit</a></td>
<td><span class="parametername">commit</span></td>
<td><p>the commit point to open </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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexCommit_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Index.IndexCommit%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L143">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Open_" data-uid="Lucene.Net.Index.DirectoryReader.Open*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexCommit_System_Int32_" data-uid="Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Index.IndexCommit,System.Int32)">Open(IndexCommit, Int32)</h4>
<div class="markdown level1 summary"><p>Expert: returns an <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> reading the index in the given
<a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a> and <code data-dev-comment-type="paramref" class="paramref">termInfosIndexDivisor</code>. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static DirectoryReader Open(IndexCommit commit, int termInfosIndexDivisor)</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.IndexCommit.html">IndexCommit</a></td>
<td><span class="parametername">commit</span></td>
<td><p>the commit point to open </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">termInfosIndexDivisor</span></td>
<td><p>Subsamples which indexed
terms are loaded into RAM. this has the same effect as setting
<a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_TermIndexInterval">TermIndexInterval</a> (on <a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html">IndexWriterConfig</a>) except that setting
must be done at indexing time while this setting can be
set per reader. When set to N, then one in every
N*termIndexInterval terms in the index is loaded into
memory. By setting this to a value &gt; 1 you can reduce
memory usage, at the expense of higher latency when
loading a TermInfo. The default value is 1. Set this
to -1 to skip loading the terms index entirely.
<strong>NOTE:</strong> divisor settings &gt; 1 do not apply to all <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>
implementations, including the default one in this release. It only makes
sense for terms indexes that can efficiently re-sample terms at load time. </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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexWriter_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Index.IndexWriter%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L110">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Open_" data-uid="Lucene.Net.Index.DirectoryReader.Open*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Index_IndexWriter_System_Boolean_" data-uid="Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Index.IndexWriter,System.Boolean)">Open(IndexWriter, Boolean)</h4>
<div class="markdown level1 summary"><p>Open a near real time <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> from the <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>.
<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 static DirectoryReader Open(IndexWriter writer, 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><a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a></td>
<td><span class="parametername">writer</span></td>
<td><p>The <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> to open from </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">applyAllDeletes</span></td>
<td><p>If <code>true</code>, all buffered deletes will
be applied (made visible) in the returned reader. If
<code>false</code>, the deletes are not applied but remain buffered
(in IndexWriter) so that they will be applied in the
future. Applying deletes can be costly, so if your app
can tolerate deleted documents being returned you might
gain some performance by passing <code>false</code>. </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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></td>
<td><p>The new <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> </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_DirectoryReader_Open_Lucene_Net_Index_IndexWriter_System_Boolean__seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexWriter_System_Boolean_">OpenIfChanged(DirectoryReader, IndexWriter, Boolean)</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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.Open(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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L64">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Open_" data-uid="Lucene.Net.Index.DirectoryReader.Open*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_" data-uid="Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Store.Directory)">Open(Directory)</h4>
<div class="markdown level1 summary"><p>Returns a <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> reading the index in the given
<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 static DirectoryReader Open(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 index directory </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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Store.Directory%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L87">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_Open_" data-uid="Lucene.Net.Index.DirectoryReader.Open*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_Open_Lucene_Net_Store_Directory_System_Int32_" data-uid="Lucene.Net.Index.DirectoryReader.Open(Lucene.Net.Store.Directory,System.Int32)">Open(Directory, Int32)</h4>
<div class="markdown level1 summary"><p>Expert: Returns a <a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> reading the index in the given
<a class="xref" href="Lucene.Net.Store.Directory.html">Directory</a> with the given termInfosIndexDivisor. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static DirectoryReader Open(Directory directory, int termInfosIndexDivisor)</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 index directory </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">termInfosIndexDivisor</span></td>
<td><p>Subsamples which indexed
terms are loaded into RAM. this has the same effect as setting
<a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_TermIndexInterval">TermIndexInterval</a> (on <a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html">IndexWriterConfig</a>) except that setting
must be done at indexing time while this setting can be
set per reader. When set to N, then one in every
N*termIndexInterval terms in the index is loaded into
memory. By setting this to a value &gt; 1 you can reduce
memory usage, at the expense of higher latency when
loading a TermInfo. The default value is 1. Set this
to -1 to skip loading the terms index entirely.
<strong>NOTE:</strong> divisor settings &gt; 1 do not apply to all <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>
implementations, including the default one in this release. It only makes
sense for terms indexes that can efficiently re-sample terms at load time. </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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.OpenIfChanged(Lucene.Net.Index.DirectoryReader)%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L171">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_" data-uid="Lucene.Net.Index.DirectoryReader.OpenIfChanged*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_" data-uid="Lucene.Net.Index.DirectoryReader.OpenIfChanged(Lucene.Net.Index.DirectoryReader)">OpenIfChanged(DirectoryReader)</h4>
<div class="markdown level1 summary"><p>If the index has changed since the provided reader was
opened, open and return a new reader; else, return
<code>null</code>. The new reader, if not <code>null</code>, will be the same
type of reader as the previous one, ie a near-real-time (NRT) reader
will open a new NRT reader, a <a class="xref" href="Lucene.Net.Index.MultiReader.html">MultiReader</a> will open a
new <a class="xref" href="Lucene.Net.Index.MultiReader.html">MultiReader</a>, etc.</p>
<p><p>This method is typically far less costly than opening a
fully new <a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a> as it shares
resources (for example sub-readers) with the provided
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a>, when possible.</p>
<p><p>The provided reader is not disposed (you are responsible
for doing so); if a new reader is returned you also
must eventually dispose it. Be sure to never dispose a
reader while other threads are still using it; see
<a class="xref" href="Lucene.Net.Search.SearcherManager.html">SearcherManager</a> to simplify managing this.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static DirectoryReader OpenIfChanged(DirectoryReader oldReader)</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.DirectoryReader.html">DirectoryReader</a></td>
<td><span class="parametername">oldReader</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><code>null</code> if there are no changes; else, a new
<a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a> instance which you must eventually dispose </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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexCommit_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.OpenIfChanged(Lucene.Net.Index.DirectoryReader%2CLucene.Net.Index.IndexCommit)%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L184">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_" data-uid="Lucene.Net.Index.DirectoryReader.OpenIfChanged*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexCommit_" data-uid="Lucene.Net.Index.DirectoryReader.OpenIfChanged(Lucene.Net.Index.DirectoryReader,Lucene.Net.Index.IndexCommit)">OpenIfChanged(DirectoryReader, IndexCommit)</h4>
<div class="markdown level1 summary"><p>If the <a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a> differs from what the
provided reader is searching, open and return a new
reader; else, return <code>null</code>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static DirectoryReader OpenIfChanged(DirectoryReader oldReader, IndexCommit commit)</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.DirectoryReader.html">DirectoryReader</a></td>
<td><span class="parametername">oldReader</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexCommit.html">IndexCommit</a></td>
<td><span class="parametername">commit</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></td>
</tr>
</tbody>
</table>
<h5 id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexCommit__seealso">See Also</h5>
<div class="seealso">
<div><a class="xref" href="Lucene.Net.Index.DirectoryReader.html#Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_">OpenIfChanged(DirectoryReader)</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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexWriter_System_Boolean_.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader.OpenIfChanged(Lucene.Net.Index.DirectoryReader%2CLucene.Net.Index.IndexWriter%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L251">View Source</a>
</span>
<a id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_" data-uid="Lucene.Net.Index.DirectoryReader.OpenIfChanged*"></a>
<h4 id="Lucene_Net_Index_DirectoryReader_OpenIfChanged_Lucene_Net_Index_DirectoryReader_Lucene_Net_Index_IndexWriter_System_Boolean_" data-uid="Lucene.Net.Index.DirectoryReader.OpenIfChanged(Lucene.Net.Index.DirectoryReader,Lucene.Net.Index.IndexWriter,System.Boolean)">OpenIfChanged(DirectoryReader, IndexWriter, Boolean)</h4>
<div class="markdown level1 summary"><p>Expert: If there changes (committed or not) in the
<a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> versus what the provided reader is
searching, then open and return a new
<a class="xref" href="Lucene.Net.Index.IndexReader.html">IndexReader</a> searching both committed and uncommitted
changes from the writer; else, return <code>null</code> (though, the
current implementation never returns <code>null</code>).</p>
<p>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>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 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
call <a class="xref" href="Lucene.Net.Index.LiveIndexWriterConfig.html#Lucene_Net_Index_LiveIndexWriterConfig_MergedSegmentWarmer">MergedSegmentWarmer</a> (on <a class="xref" href="Lucene.Net.Index.IndexWriterConfig.html">IndexWriterConfig</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 static DirectoryReader OpenIfChanged(DirectoryReader oldReader, IndexWriter writer, 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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></td>
<td><span class="parametername">oldReader</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a></td>
<td><span class="parametername">writer</span></td>
<td><p>The <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a> to open from</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td><span class="parametername">applyAllDeletes</span></td>
<td><p>If <code>true</code>, all buffered deletes will
be applied (made visible) in the returned reader. If
<code>false</code>, the deletes are not applied but remain buffered
(in <a class="xref" href="Lucene.Net.Index.IndexWriter.html">IndexWriter</a>) so that they will be applied in the
future. Applying deletes can be costly, so if your app
can tolerate deleted documents being returned you might
gain some performance by passing <code>false</code>.</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><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</a></td>
<td><p><a class="xref" href="Lucene.Net.Index.DirectoryReader.html">DirectoryReader</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, or
<code>null</code> if there are no new changes</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 IO error </p>
</td>
</tr>
</tbody>
</table>
<h3 id="implements">Implements</h3>
<div>
<span class="xref">System.IDisposable</span>
</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-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Index_DirectoryReader.md&amp;value=---%0Auid%3A%20Lucene.Net.Index.DirectoryReader%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/fix/apidocs-layout/src/Lucene.Net/Index/DirectoryReader.cs/#L49" 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 The Apache Software Foundation, Licensed under the <a href='http://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache License, Version 2.0</a><br> <small>Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. <br>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</small>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>