⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indexwriter.java

📁 全文检索lucene2.0的源码 请笑纳
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
  /**   * 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.   *   * @param d the index directory   * @param a the analyzer to use   * @param create <code>true</code> to create the index or overwrite   *  the existing one; <code>false</code> to append to the existing   *  index   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be read/written to, or   *  if it does not exist and <code>create</code> is   *  <code>false</code> or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0   *  release, and call {@link #commit()} when needed.   *  Use {@link #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)} instead.   */  public IndexWriter(Directory d, Analyzer a, boolean create)       throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, create, false, null, true, DEFAULT_MAX_FIELD_LENGTH);  }  /**   * Constructs an IndexWriter for the index in   * <code>path</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * <p><b>NOTE</b>: autoCommit (see <a   * href="#autoCommit">above</a>) is set to false with this   * constructor.   *   * @param path the path to the index directory   * @param a the analyzer to use   * @param mfl Maximum field length: LIMITED, UNLIMITED, or user-specified   *   via the MaxFieldLength constructor.   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   */  public IndexWriter(String path, Analyzer a, MaxFieldLength mfl)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(FSDirectory.getDirectory(path), a, true, null, false, mfl.getLimit());  }  /**   * Constructs an IndexWriter for the index in   * <code>path</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * @param path the path to the index directory   * @param a the analyzer to use   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0   *  release, and call {@link #commit()} when needed.   *  Use {@link #IndexWriter(String,Analyzer,MaxFieldLength)} instead.   */  public IndexWriter(String path, Analyzer a)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(FSDirectory.getDirectory(path), a, true, null, true, DEFAULT_MAX_FIELD_LENGTH);  }  /**   * Constructs an IndexWriter for the index in   * <code>path</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * <p><b>NOTE</b>: autoCommit (see <a   * href="#autoCommit">above</a>) is set to false with this   * constructor.   *   * @param path the path to the index directory   * @param a the analyzer to use   * @param mfl Maximum field length: LIMITED, UNLIMITED, or user-specified   *   via the MaxFieldLength constructor.   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   */  public IndexWriter(File path, Analyzer a, MaxFieldLength mfl)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(FSDirectory.getDirectory(path), a, true, null, false, mfl.getLimit());  }  /**   * Constructs an IndexWriter for the index in   * <code>path</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * @param path the path to the index directory   * @param a the analyzer to use   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0 release.   *  Use {@link #IndexWriter(File,Analyzer,MaxFieldLength)}   *  instead, and call {@link #commit()} when needed.   */  public IndexWriter(File path, Analyzer a)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(FSDirectory.getDirectory(path), a, true, null, true, DEFAULT_MAX_FIELD_LENGTH);  }  /**   * Constructs an IndexWriter for the index in   * <code>d</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * <p><b>NOTE</b>: autoCommit (see <a   * href="#autoCommit">above</a>) is set to false with this   * constructor.   *   * @param d the index directory   * @param a the analyzer to use   * @param mfl Maximum field length: LIMITED, UNLIMITED, or user-specified   *   via the MaxFieldLength constructor.   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   */  public IndexWriter(Directory d, Analyzer a, MaxFieldLength mfl)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, false, null, false, mfl.getLimit());  }  /**   * Constructs an IndexWriter for the index in   * <code>d</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * @param d the index directory   * @param a the analyzer to use   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0 release.   *  Use {@link   *  #IndexWriter(Directory,Analyzer,MaxFieldLength)}   *  instead, and call {@link #commit()} when needed.   */  public IndexWriter(Directory d, Analyzer a)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, false, null, true, DEFAULT_MAX_FIELD_LENGTH);  }  /**   * Constructs an IndexWriter for the index in   * <code>d</code>, first creating it if it does not   * already exist.  Text will be analyzed with   * <code>a</code>.   *   * @param d the index directory   * @param autoCommit see <a href="#autoCommit">above</a>   * @param a the analyzer to use   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0 release.   *  Use {@link   *  #IndexWriter(Directory,Analyzer,MaxFieldLength)}   *  instead, and call {@link #commit()} when needed.   */  public IndexWriter(Directory d, boolean autoCommit, Analyzer a)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, false, null, autoCommit, DEFAULT_MAX_FIELD_LENGTH);  }  /**   * 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.   *   * @param d the index directory   * @param autoCommit see <a href="#autoCommit">above</a>   * @param a the analyzer to use   * @param create <code>true</code> to create the index or overwrite   *  the existing one; <code>false</code> to append to the existing   *  index   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be read/written to, or   *  if it does not exist and <code>create</code> is   *  <code>false</code> or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0 release.   *  Use {@link   *  #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)}   *  instead, and call {@link #commit()} when needed.   */  public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create)       throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, create, false, null, autoCommit, DEFAULT_MAX_FIELD_LENGTH);  }  /**   * Expert: constructs an IndexWriter with a custom {@link   * IndexDeletionPolicy}, for the index in <code>d</code>,   * first creating it if it does not already exist.  Text   * will be analyzed with <code>a</code>.   *   * <p><b>NOTE</b>: autoCommit (see <a   * href="#autoCommit">above</a>) is set to false with this   * constructor.   *   * @param d the index directory   * @param a the analyzer to use   * @param deletionPolicy see <a href="#deletionPolicy">above</a>   * @param mfl whether or not to limit field lengths   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   */  public IndexWriter(Directory d, Analyzer a, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, false, deletionPolicy, false, mfl.getLimit());  }  /**   * Expert: constructs an IndexWriter with a custom {@link   * IndexDeletionPolicy}, for the index in <code>d</code>,   * first creating it if it does not already exist.  Text   * will be analyzed with <code>a</code>.   *   * @param d the index directory   * @param autoCommit see <a href="#autoCommit">above</a>   * @param a the analyzer to use   * @param deletionPolicy see <a href="#deletionPolicy">above</a>   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be   *  read/written to or if there is any other low-level   *  IO error   * @deprecated This constructor will be removed in the 3.0 release.   *  Use {@link   *  #IndexWriter(Directory,Analyzer,IndexDeletionPolicy,MaxFieldLength)}   *  instead, and call {@link #commit()} when needed.   */  public IndexWriter(Directory d, boolean autoCommit, Analyzer a, IndexDeletionPolicy deletionPolicy)    throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, false, deletionPolicy, autoCommit, DEFAULT_MAX_FIELD_LENGTH);  }    /**   * Expert: constructs an IndexWriter with a custom {@link   * IndexDeletionPolicy}, 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><b>NOTE</b>: autoCommit (see <a   * href="#autoCommit">above</a>) is set to false with this   * constructor.   *   * @param d the index directory   * @param a the analyzer to use   * @param create <code>true</code> to create the index or overwrite   *  the existing one; <code>false</code> to append to the existing   *  index   * @param deletionPolicy see <a href="#deletionPolicy">above</a>   * @param mfl whether or not to limit field lengths   * @throws CorruptIndexException if the index is corrupt   * @throws LockObtainFailedException if another writer   *  has this index open (<code>write.lock</code> could not   *  be obtained)   * @throws IOException if the directory cannot be read/written to, or   *  if it does not exist and <code>create</code> is   *  <code>false</code> or if there is any other low-level   *  IO error   */  public IndexWriter(Directory d, Analyzer a, boolean create, IndexDeletionPolicy deletionPolicy, MaxFieldLength mfl)       throws CorruptIndexException, LockObtainFailedException, IOException {    init(d, a, create, false, deletionPolicy, false, mfl.getLimit());  }  /**   * Expert: constructs an IndexWriter with a custom {@link   * IndexDeletionPolicy}, 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.   *   * @param d the index directory   * @param autoCommit see <a href="#autoCommit">above</a>   * @param a the analyzer to use

⌨️ 快捷键说明

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