improve IW javadocs

This commit is contained in:
Mike McCandless 2016-12-02 15:30:37 -05:00
parent fcccd317dd
commit 58476b1675
1 changed files with 18 additions and 13 deletions

View File

@ -133,19 +133,24 @@ import org.apache.lucene.util.Version;
<a name="deletionPolicy"></a> <a name="deletionPolicy"></a>
<p>Expert: <code>IndexWriter</code> allows an optional <p>Expert: <code>IndexWriter</code> allows an optional
{@link IndexDeletionPolicy} implementation to be {@link IndexDeletionPolicy} implementation to be specified. You
specified. You can use this to control when prior commits can use this to control when prior commits are deleted from
are deleted from the index. The default policy is {@link the index. The default policy is {@link KeepOnlyLastCommitDeletionPolicy}
KeepOnlyLastCommitDeletionPolicy} which removes all prior which removes all prior commits as soon as a new commit is
commits as soon as a new commit is done (this matches done. Creating your own policy can allow you to explicitly
behavior before 2.2). Creating your own policy can allow keep previous "point in time" commits alive in the index for
you to explicitly keep previous "point in time" commits some time, either because this is useful for your application,
alive in the index for some time, to allow readers to or to give readers enough time to refresh to the new commit
refresh to the new commit without having the old commit without having the old commit deleted out from under them.
deleted out from under them. This is necessary on The latter is necessary when multiple computers take turns opening
filesystems like NFS that do not support "delete on last their own {@code IndexWriter} and {@code IndexReader}s
close" semantics, which Lucene's "point in time" search against a single shared index mounted via remote filesystems
normally relies on. </p> like NFS which do not support "delete on last close" semantics.
A single computer accessing an index via NFS is fine with the
default deletion policy since NFS clients emulate "delete on
last close" locally. That said, accessing an index via NFS
will likely result in poor performance compared to a local IO
device. </p>
<a name="mergePolicy"></a> <p>Expert: <a name="mergePolicy"></a> <p>Expert:
<code>IndexWriter</code> allows you to separately change <code>IndexWriter</code> allows you to separately change