indexwriter.html

来自「 Lucene是apache软件基金会[4] jakarta项目组的一个子项目」· HTML 代码 · 共 1,329 行 · 第 1/5 页

HTML
1,329
字号
<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if maxBufferedDocs is smaller than 2</DL>
</DD>
</DL>
<HR>

<A NAME="getMaxBufferedDocs()"><!-- --></A><H3>
getMaxBufferedDocs</H3>
<PRE>
public int <B>getMaxBufferedDocs</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setMaxBufferedDocs(int)"><CODE>setMaxBufferedDocs(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setMaxBufferedDeleteTerms(int)"><!-- --></A><H3>
setMaxBufferedDeleteTerms</H3>
<PRE>
public void <B>setMaxBufferedDeleteTerms</B>(int&nbsp;maxBufferedDeleteTerms)</PRE>
<DL>
<DD><p>Determines the minimal number of delete terms required before the buffered in-memory delete terms are applied and flushed. If there are documents buffered in memory at the time, they are merged and a new segment is created.</p> <p>The default value is <A HREF="../../../../org/apache/lucene/index/IndexWriter.html#DEFAULT_MAX_BUFFERED_DELETE_TERMS"><CODE>DEFAULT_MAX_BUFFERED_DELETE_TERMS</CODE></A>.
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if maxBufferedDeleteTerms is smaller than 1</p></DL>
</DD>
</DL>
<HR>

<A NAME="getMaxBufferedDeleteTerms()"><!-- --></A><H3>
getMaxBufferedDeleteTerms</H3>
<PRE>
public int <B>getMaxBufferedDeleteTerms</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setMaxBufferedDeleteTerms(int)"><CODE>setMaxBufferedDeleteTerms(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setMergeFactor(int)"><!-- --></A><H3>
setMergeFactor</H3>
<PRE>
public void <B>setMergeFactor</B>(int&nbsp;mergeFactor)</PRE>
<DL>
<DD>Determines how often segment indices are merged by addDocument().  With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower.  With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster.  Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained. <p>This must never be less than 2.  The default value is 10.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getMergeFactor()"><!-- --></A><H3>
getMergeFactor</H3>
<PRE>
public int <B>getMergeFactor</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setMergeFactor(int)"><CODE>setMergeFactor(int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setInfoStream(java.io.PrintStream)"><!-- --></A><H3>
setInfoStream</H3>
<PRE>
public void <B>setInfoStream</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/PrintStream.html" title="class or interface in java.io">PrintStream</A>&nbsp;infoStream)</PRE>
<DL>
<DD>If non-null, information about merges and a message when maxFieldLength is reached will be printed to this.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getInfoStream()"><!-- --></A><H3>
getInfoStream</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/PrintStream.html" title="class or interface in java.io">PrintStream</A> <B>getInfoStream</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setInfoStream(java.io.PrintStream)"><CODE>setInfoStream(java.io.PrintStream)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setWriteLockTimeout(long)"><!-- --></A><H3>
setWriteLockTimeout</H3>
<PRE>
public void <B>setWriteLockTimeout</B>(long&nbsp;writeLockTimeout)</PRE>
<DL>
<DD>Sets the maximum time to wait for a write lock (in milliseconds) for this instance of IndexWriter.  @see
<P>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setDefaultWriteLockTimeout(long)"><CODE>to change the default value for all instances of IndexWriter.</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getWriteLockTimeout()"><!-- --></A><H3>
getWriteLockTimeout</H3>
<PRE>
public long <B>getWriteLockTimeout</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setWriteLockTimeout(long)"><CODE>setWriteLockTimeout(long)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="setDefaultWriteLockTimeout(long)"><!-- --></A><H3>
setDefaultWriteLockTimeout</H3>
<PRE>
public static void <B>setDefaultWriteLockTimeout</B>(long&nbsp;writeLockTimeout)</PRE>
<DL>
<DD>Sets the default (for any instance of IndexWriter) maximum time to wait for a write lock (in milliseconds).
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getDefaultWriteLockTimeout()"><!-- --></A><H3>
getDefaultWriteLockTimeout</H3>
<PRE>
public static long <B>getDefaultWriteLockTimeout</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setDefaultWriteLockTimeout(long)"><CODE>setDefaultWriteLockTimeout(long)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()           throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Flushes all changes to an index and closes all associated files. <p> If an Exception 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 IndexWriter 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 close() again. Failing that, if you want to force the write lock to be released (dangerous, because you may then lose buffered docs in the IndexWriter instance) then you can do something like this:</p> <pre> try {   writer.close(); } finally {   if (IndexReader.isLocked(directory)) {     IndexReader.unlock(directory);   } } </pre> after which, you must be certain not to use the writer instance anymore.</p>
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="finalize()"><!-- --></A><H3>
finalize</H3>
<PRE>
protected void <B>finalize</B>()                 throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Throwable.html" title="class or interface in java.lang">Throwable</A></PRE>
<DL>
<DD>Release the write lock, if needed.
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Throwable.html" title="class or interface in java.lang">Throwable</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="getDirectory()"><!-- --></A><H3>
getDirectory</H3>
<PRE>
public <A HREF="../../../../org/apache/lucene/store/Directory.html" title="class in org.apache.lucene.store">Directory</A> <B>getDirectory</B>()</PRE>
<DL>
<DD>Returns the Directory used by this index.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="getAnalyzer()"><!-- --></A><H3>
getAnalyzer</H3>
<PRE>
public <A HREF="../../../../org/apache/lucene/analysis/Analyzer.html" title="class in org.apache.lucene.analysis">Analyzer</A> <B>getAnalyzer</B>()</PRE>
<DL>
<DD>Returns the analyzer used by this index.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="docCount()"><!-- --></A><H3>
docCount</H3>
<PRE>
public int <B>docCount</B>()</PRE>
<DL>
<DD>Returns the number of documents currently in this index.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="addDocument(org.apache.lucene.document.Document)"><!-- --></A><H3>
addDocument</H3>
<PRE>
public void <B>addDocument</B>(<A HREF="../../../../org/apache/lucene/document/Document.html" title="class in org.apache.lucene.document">Document</A>&nbsp;doc)                 throws <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html" title="class or interface in java.io">IOException</A></PRE>
<DL>
<DD>Adds a document to this index.  If the document contains more than <A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setMaxFieldLength(int)"><CODE>setMaxFieldLength(int)</CODE></A> terms for a given field, the remainder are discarded. <p> Note that if an Exception is hit (for example disk full

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?