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:07:22 UTC

svn commit: r1195098 - /lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/IndexSearcher.java

Author: rmuir
Date: Sun Oct 30 03:07:22 2011
New Revision: 1195098

URL: http://svn.apache.org/viewvc?rev=1195098&view=rev
Log:
LUCENE-3490: add ctor with CodecProvider

Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/IndexSearcher.java

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/IndexSearcher.java?rev=1195098&r1=1195097&r2=1195098&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/IndexSearcher.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/search/IndexSearcher.java Sun Oct 30 03:07:22 2011
@@ -37,6 +37,7 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.StoredFieldVisitor;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.search.similarities.DefaultSimilarityProvider;
 import org.apache.lucene.search.similarities.SimilarityProvider;
 import org.apache.lucene.store.Directory;
@@ -125,6 +126,22 @@ public class IndexSearcher implements Cl
   public IndexSearcher(Directory path, boolean readOnly) throws CorruptIndexException, IOException {
     this(IndexReader.open(path, readOnly), true, null);
   }
+  
+  /** Creates a searcher searching the index in the named
+   *  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 underlying IndexReader.
+   * @param path directory where IndexReader will be opened
+   * @param readOnly if true, the underlying IndexReader
+   * will be opened readOnly
+   * @param codecProvider {@link CodecProvider} used for reading the index
+   * @throws CorruptIndexException if the index is corrupt
+   * @throws IOException if there is a low-level IO error
+   */
+  public IndexSearcher(Directory path, boolean readOnly, CodecProvider codecProvider) throws CorruptIndexException, IOException {
+    this(IndexReader.open(path, readOnly, codecProvider), true, null);
+  }
 
   /** Creates a searcher searching the provided index. */
   public IndexSearcher(IndexReader r) {