blob: f8942eb602e81b8b5099731400e010b5f8a92ed9 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3"/>
<title>Lucene.Net: Lucene.Net.Index.IndexDeletionPolicy Interface Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="lucene-net-icon-128x128.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Lucene.Net
&#160;<span id="projectnumber">3.0.3</span>
</div>
<div id="projectbrief">Lucene.Net is a .NET port of the Java Lucene Indexing Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="Index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Packages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Properties</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_lucene.html">Lucene</a></li><li class="navelem"><a class="el" href="namespace_lucene_1_1_net.html">Net</a></li><li class="navelem"><a class="el" href="namespace_lucene_1_1_net_1_1_index.html">Index</a></li><li class="navelem"><a class="el" href="interface_lucene_1_1_net_1_1_index_1_1_index_deletion_policy.html">IndexDeletionPolicy</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="interface_lucene_1_1_net_1_1_index_1_1_index_deletion_policy-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Lucene.Net.Index.IndexDeletionPolicy Interface Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Expert: policy for deletion of stale <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html">index commits</a>.
<a href="interface_lucene_1_1_net_1_1_index_1_1_index_deletion_policy.html#details">More...</a></p>
<p>Inherited by <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_keep_only_last_commit_deletion_policy.html">Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy</a>, and <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_snapshot_deletion_policy.html">Lucene.Net.Index.SnapshotDeletionPolicy</a>.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae7b18e03b1a5b492c34e0bd88ae66ccf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_lucene_1_1_net_1_1_index_1_1_index_deletion_policy.html#ae7b18e03b1a5b492c34e0bd88ae66ccf">OnInit&lt; T &gt;</a> (IList&lt; T &gt; commits)</td></tr>
<tr class="memdesc:ae7b18e03b1a5b492c34e0bd88ae66ccf"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is called once when a writer is first instantiated to give the policy a chance to remove old commit points. <a href="#ae7b18e03b1a5b492c34e0bd88ae66ccf"></a><br/></td></tr>
<tr class="separator:ae7b18e03b1a5b492c34e0bd88ae66ccf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae76463710c22a8e4ee337f22ac11a680"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_lucene_1_1_net_1_1_index_1_1_index_deletion_policy.html#ae76463710c22a8e4ee337f22ac11a680">OnCommit&lt; T &gt;</a> (IList&lt; T &gt; commits)</td></tr>
<tr class="memdesc:ae76463710c22a8e4ee337f22ac11a680"><td class="mdescLeft">&#160;</td><td class="mdescRight"> <a href="#ae76463710c22a8e4ee337f22ac11a680"></a><br/></td></tr>
<tr class="separator:ae76463710c22a8e4ee337f22ac11a680"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Expert: policy for deletion of stale <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html">index commits</a>. </p>
<p>Implement this interface, and pass it to one of the <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_writer.html" title="An IndexWriter creates and maintains an index. The create argument to the constructor determines whet...">IndexWriter</a> or <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_reader.html" title="IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...">IndexReader</a> constructors, to customize when older <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html">point-in-time commits</a> are deleted from the index directory. The default deletion policy is <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_keep_only_last_commit_deletion_policy.html" title="This IndexDeletionPolicy implementation that keeps only the most recent commit and immediately remove...">KeepOnlyLastCommitDeletionPolicy</a>, which always removes old commits as soon as a new commit is done (this matches the behavior before 2.2).</p>
<p>One expected use case for this (and the reason why it was first created) is to work around problems with an index directory accessed via filesystems like NFS because NFS does not provide the "delete on last close" semantics that <a class="el" href="namespace_lucene.html">Lucene</a>'s "point in time" search normally relies on. By implementing a custom deletion policy, such as "a commit is only removed once it has been stale for more than X minutes", you can give your readers time to
refresh to the new commit before &lt;see cref="<a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_writer.html" title="An IndexWriter creates and maintains an index. The create argument to the constructor determines whet...">IndexWriter</a>" /&gt; removes the old commits. Note that doing so will increase the storage requirements of the index. See <a href="http://issues.apache.org/jira/browse/LUCENE-710" target="top">LUCENE-710</a> for details.</p>
<p>Definition at line <a class="el" href="_index_deletion_policy_8cs_source.html#l00051">51</a> of file <a class="el" href="_index_deletion_policy_8cs_source.html">IndexDeletionPolicy.cs</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ae76463710c22a8e4ee337f22ac11a680"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Lucene.Net.Index.IndexDeletionPolicy.OnCommit&lt; T &gt; </td>
<td>(</td>
<td class="paramtype">IList&lt; T &gt;&#160;</td>
<td class="paramname"><em>commits</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p></p>
<p>This is called each time the writer completed a commit. This gives the policy a chance to remove old commit points with each commit.</p>
<p>The policy may now choose to delete old commit points by calling method <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html#aff47e6a2b3b8fca0b391a4ed4a19347e" title="Delete this commit point. This only applies when using the commit point in the context of IndexWriter...">IndexCommit.Delete()</a> of <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html" title="Expert: represents a single commit into an index as seen by the IndexDeletionPolicy or IndexReader...">IndexCommit</a>.</p>
<p>This method is only called when <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_writer.html#ad1df12452bb45f153d9d06e1c160e2ff" title="Commits all pending changes (added &amp; deleted documents, optimizations, 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.">IndexWriter.Commit()</a> or <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_writer.html#abe4383aeee76431a2b30b10e5ffb4b87" title="Commits all changes to an index and closes all associated files. Note that this may be a costly opera...">IndexWriter.Close()</a> is called, or possibly not at all if the <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_writer.html#a6585064853f33355bf4b450ec88fd727" title="Close the IndexWriter without committing any changes that have occurred since the last commit (or sin...">IndexWriter.Rollback()</a> is called.</p>
<p>&lt;u&gt;Note:&lt;/u&gt; the last CommitPoint is the most recent one, i.e. the "front index state". Be careful not to delete it, unless you know for sure what you are doing, and unless you can afford to lose the index content while doing that.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">commits</td><td>List of <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html" title="Expert: represents a single commit into an index as seen by the IndexDeletionPolicy or IndexReader...">IndexCommit</a>, sorted by age (the 0th one is the oldest commit). </td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_snapshot_deletion_policy.html#ac1c9a28aca785e3a0f462a0948b8444f">Lucene.Net.Index.SnapshotDeletionPolicy</a>, and <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_keep_only_last_commit_deletion_policy.html#a9863ab407b9a87df65221b8219d5a195">Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy</a>.</p>
<div class="typeconstraint">
<dl><dt><b>Type Constraints</b><dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em>T</em></td><td>&#160;:</td><td valign="top"><em>IndexCommit</em></td><td>&#160;</td></tr>
</table>
</dl>
</div>
</div>
</div>
<a class="anchor" id="ae7b18e03b1a5b492c34e0bd88ae66ccf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Lucene.Net.Index.IndexDeletionPolicy.OnInit&lt; T &gt; </td>
<td>(</td>
<td class="paramtype">IList&lt; T &gt;&#160;</td>
<td class="paramname"><em>commits</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This is called once when a writer is first instantiated to give the policy a chance to remove old commit points.</p>
<p>The writer locates all index commits present in the index directory and calls this method. The policy may choose to delete some of the commit points, doing so by calling method <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html#aff47e6a2b3b8fca0b391a4ed4a19347e" title="Delete this commit point. This only applies when using the commit point in the context of IndexWriter...">IndexCommit.Delete()</a> of <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html" title="Expert: represents a single commit into an index as seen by the IndexDeletionPolicy or IndexReader...">IndexCommit</a>.</p>
<p>&lt;u&gt;Note:&lt;/u&gt; the last CommitPoint is the most recent one, i.e. the "front index state". Be careful not to delete it, unless you know for sure what you are doing, and unless you can afford to lose the index content while doing that.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">commits</td><td>List of current <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_index_commit.html">point-in-time commits</a>, sorted by age (the 0th one is the oldest commit). </td></tr>
</table>
</dd>
</dl>
<p>Implemented in <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_snapshot_deletion_policy.html#acd222cd7383e88ccbcb151af8c8c5826">Lucene.Net.Index.SnapshotDeletionPolicy</a>, and <a class="el" href="class_lucene_1_1_net_1_1_index_1_1_keep_only_last_commit_deletion_policy.html#ac51cfe90136a93469939c5408fa83cdc">Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy</a>.</p>
<div class="typeconstraint">
<dl><dt><b>Type Constraints</b><dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em>T</em></td><td>&#160;:</td><td valign="top"><em>IndexCommit</em></td><td>&#160;</td></tr>
</table>
</dl>
</div>
</div>
</div>
<hr/>The documentation for this interface was generated from the following file:<ul>
<li>core/Index/<a class="el" href="_index_deletion_policy_8cs_source.html">IndexDeletionPolicy.cs</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 3 2013 02:12:50 for Lucene.Net by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3
</small></address>
</body>
</html>