?? indexwriter.html
字號:
<HR>
<A NAME="IndexWriter(org.apache.lucene.store.Directory, org.apache.lucene.analysis.Analyzer, boolean)"><!-- --></A><H3>
IndexWriter</H3>
<PRE>
public <B>IndexWriter</B>(<A HREF="../../../../org/apache/lucene/store/Directory.html" title="class in org.apache.lucene.store">Directory</A> d, <A HREF="../../../../org/apache/lucene/analysis/Analyzer.html" title="class in org.apache.lucene.analysis">Analyzer</A> a, boolean create) 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>Constructs an IndexWriter for the index in <code>d</code>. Text will be analyzed with <code>a</code>. If <code>create</code> is true, then a new, empty index will be created in <code>d</code>, replacing the index already there, if any.
<P>
<DT><B>Parameters:</B><DD><CODE>d</CODE> - the index directory<DD><CODE>a</CODE> - the analyzer to use<DD><CODE>create</CODE> - <code>true</code> to create the index or overwrite the existing one; <code>false</code> to append to the existing index<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> - if the directory cannot be read/written to, or if it does not exist, and <code>create</code> is <code>false</code></DL>
<HR>
<A NAME="IndexWriter(java.lang.String, org.apache.lucene.analysis.Analyzer)"><!-- --></A><H3>
IndexWriter</H3>
<PRE>
public <B>IndexWriter</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> path, <A HREF="../../../../org/apache/lucene/analysis/Analyzer.html" title="class in org.apache.lucene.analysis">Analyzer</A> a) 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>Constructs an IndexWriter for the index in <code>path</code>, creating it first if it does not already exist, otherwise appending to the existing index. Text will be analyzed with <code>a</code>.
<P>
<DT><B>Parameters:</B><DD><CODE>path</CODE> - the path to the index directory<DD><CODE>a</CODE> - the analyzer to use<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> - if the directory cannot be created or read/written to</DL>
<HR>
<A NAME="IndexWriter(java.io.File, org.apache.lucene.analysis.Analyzer)"><!-- --></A><H3>
IndexWriter</H3>
<PRE>
public <B>IndexWriter</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/File.html" title="class or interface in java.io">File</A> path, <A HREF="../../../../org/apache/lucene/analysis/Analyzer.html" title="class in org.apache.lucene.analysis">Analyzer</A> a) 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>Constructs an IndexWriter for the index in <code>path</code>, creating it first if it does not already exist, otherwise appending to the existing index. Text will be analyzed with <code>a</code>.
<P>
<DT><B>Parameters:</B><DD><CODE>path</CODE> - the path to the index directory<DD><CODE>a</CODE> - the analyzer to use<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> - if the directory cannot be created or read/written to</DL>
<HR>
<A NAME="IndexWriter(org.apache.lucene.store.Directory, org.apache.lucene.analysis.Analyzer)"><!-- --></A><H3>
IndexWriter</H3>
<PRE>
public <B>IndexWriter</B>(<A HREF="../../../../org/apache/lucene/store/Directory.html" title="class in org.apache.lucene.store">Directory</A> d, <A HREF="../../../../org/apache/lucene/analysis/Analyzer.html" title="class in org.apache.lucene.analysis">Analyzer</A> a) 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>Constructs an IndexWriter for the index in <code>d</code>, creating it first if it does not already exist, otherwise appending to the existing index. Text will be analyzed with <code>a</code>.
<P>
<DT><B>Parameters:</B><DD><CODE>d</CODE> - the index directory<DD><CODE>a</CODE> - the analyzer to use<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> - if the directory cannot be created or read/written to</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="getUseCompoundFile()"><!-- --></A><H3>
getUseCompoundFile</H3>
<PRE>
public boolean <B>getUseCompoundFile</B>()</PRE>
<DL>
<DD>Get the current setting of whether to use the compound file format. Note that this just returns the value you set with setUseCompoundFile(boolean) or the default. You cannot use this to query the status of an existing index.
<P>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setUseCompoundFile(boolean)"><CODE>setUseCompoundFile(boolean)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setUseCompoundFile(boolean)"><!-- --></A><H3>
setUseCompoundFile</H3>
<PRE>
public void <B>setUseCompoundFile</B>(boolean value)</PRE>
<DL>
<DD>Setting to turn on usage of a compound file. When on, multiple files for each segment are merged into a single file once the segment creation is finished. This is done regardless of what directory is in use.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setSimilarity(org.apache.lucene.search.Similarity)"><!-- --></A><H3>
setSimilarity</H3>
<PRE>
public void <B>setSimilarity</B>(<A HREF="../../../../org/apache/lucene/search/Similarity.html" title="class in org.apache.lucene.search">Similarity</A> similarity)</PRE>
<DL>
<DD>Expert: Set the Similarity implementation used by this IndexWriter.
<P>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/search/Similarity.html#setDefault(org.apache.lucene.search.Similarity)"><CODE>Similarity.setDefault(Similarity)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getSimilarity()"><!-- --></A><H3>
getSimilarity</H3>
<PRE>
public <A HREF="../../../../org/apache/lucene/search/Similarity.html" title="class in org.apache.lucene.search">Similarity</A> <B>getSimilarity</B>()</PRE>
<DL>
<DD>Expert: Return the Similarity implementation used by this IndexWriter. <p>This defaults to the current value of <A HREF="../../../../org/apache/lucene/search/Similarity.html#getDefault()"><CODE>Similarity.getDefault()</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setTermIndexInterval(int)"><!-- --></A><H3>
setTermIndexInterval</H3>
<PRE>
public void <B>setTermIndexInterval</B>(int interval)</PRE>
<DL>
<DD>Expert: Set the interval between indexed terms. Large values cause less memory to be used by IndexReader, but slow random-access to terms. Small values cause more memory to be used by an IndexReader, and speed random-access to terms. This parameter determines the amount of computation required per query term, regardless of the number of documents that contain that term. In particular, it is the maximum number of other terms that must be scanned before a term is located and its frequency and position information may be processed. In a large index with user-entered query terms, query processing time is likely to be dominated not by term lookup but rather by the processing of frequency and positional data. In a small index or when many uncommon query terms are generated (e.g., by wildcard queries) term lookup may become a dominant cost. In particular, <code>numUniqueTerms/interval</code> terms are read into memory by an IndexReader, and, on average, <code>interval/2</code> terms must be scanned for each random term access.
<P>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#DEFAULT_TERM_INDEX_INTERVAL"><CODE>DEFAULT_TERM_INDEX_INTERVAL</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getTermIndexInterval()"><!-- --></A><H3>
getTermIndexInterval</H3>
<PRE>
public int <B>getTermIndexInterval</B>()</PRE>
<DL>
<DD>Expert: Return the interval between indexed terms.
<P>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setTermIndexInterval(int)"><CODE>setTermIndexInterval(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setMaxMergeDocs(int)"><!-- --></A><H3>
setMaxMergeDocs</H3>
<PRE>
public void <B>setMaxMergeDocs</B>(int maxMergeDocs)</PRE>
<DL>
<DD>Determines the largest number of documents ever merged by addDocument(). Small values (e.g., less than 10,000) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches. <p>The default value is <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Integer.html#MAX_VALUE" title="class or interface in java.lang"><CODE>Integer.MAX_VALUE</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getMaxMergeDocs()"><!-- --></A><H3>
getMaxMergeDocs</H3>
<PRE>
public int <B>getMaxMergeDocs</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setMaxMergeDocs(int)"><CODE>setMaxMergeDocs(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setMaxFieldLength(int)"><!-- --></A><H3>
setMaxFieldLength</H3>
<PRE>
public void <B>setMaxFieldLength</B>(int maxFieldLength)</PRE>
<DL>
<DD>The maximum number of terms that will be indexed for a single field in a document. This limits the amount of memory required for indexing, so that collections with very large files will not crash the indexing process by running out of memory.<p/> Note that this effectively truncates large documents, excluding from the index terms that occur further in the document. If you know your source documents are large, be sure to set this value high enough to accomodate the expected size. If you set it to Integer.MAX_VALUE, then the only limit is your memory, but you should anticipate an OutOfMemoryError.<p/> By default, no more than 10,000 terms will be indexed for a field.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getMaxFieldLength()"><!-- --></A><H3>
getMaxFieldLength</H3>
<PRE>
public int <B>getMaxFieldLength</B>()</PRE>
<DL>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/lucene/index/IndexWriter.html#setMaxFieldLength(int)"><CODE>setMaxFieldLength(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setMaxBufferedDocs(int)"><!-- --></A><H3>
setMaxBufferedDocs</H3>
<PRE>
public void <B>setMaxBufferedDocs</B>(int maxBufferedDocs)</PRE>
<DL>
<DD>Determines the minimal number of documents required before the buffered in-memory documents are merged and a new Segment is created. Since Documents are merged in a <A HREF="../../../../org/apache/lucene/store/RAMDirectory.html" title="class in org.apache.lucene.store"><CODE>RAMDirectory</CODE></A>, large value gives faster indexing. At the same time, mergeFactor limits the number of files open in a FSDirectory. <p> The default value is 10.
<P>
<DD><DL>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -