You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/10/30 04:00:46 UTC

svn commit: r1195097 - /lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexReader.java

Author: rmuir
Date: Sun Oct 30 03:00:45 2011
New Revision: 1195097

URL: http://svn.apache.org/viewvc?rev=1195097&view=rev
Log:
LUCENE-3490: don't make it so hard to pass a CodecProvider to IndexReader

Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexReader.java

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1195097&r1=1195096&r2=1195097&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexReader.java Sun Oct 30 03:00:45 2011
@@ -328,6 +328,21 @@ public abstract class IndexReader implem
   public static IndexReader open(final Directory directory, boolean readOnly) throws CorruptIndexException, IOException {
     return open(directory, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR, CodecProvider.getDefault());
   }
+  
+  /** Returns an IndexReader reading the index in the given
+   *  Directory.  You should pass readOnly=true, since it
+   *  gives much better concurrent performance, unless you
+   *  intend to do write operations (delete documents or
+   *  change norms) with the reader.
+   * @param directory the index directory
+   * @param readOnly true if no changes (deletions, norms) will be made with this IndexReader
+   * @param codecProvider {@link CodecProvider} to use for reading the index
+   * @throws CorruptIndexException if the index is corrupt
+   * @throws IOException if there is a low-level IO error
+   */
+  public static IndexReader open(final Directory directory, boolean readOnly, CodecProvider codecProvider) throws CorruptIndexException, IOException {
+    return open(directory, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR, codecProvider);
+  }
 
   /**
    * Open a near real time IndexReader from the {@link org.apache.lucene.index.IndexWriter}.