lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r825328 - in /lucene/java/branches/flex_1458: ./ contrib/instantiated/src/java/org/apache/lucene/store/instantiated/ contrib/instantiated/src/test/org/apache/lucene/store/instantiated/ contrib/misc/src/java/org/apache/lucene/index/ contrib/...
Date Wed, 14 Oct 2009 22:56:32 GMT
Author: markrmiller
Date: Wed Oct 14 22:56:29 2009
New Revision: 825328

URL: http://svn.apache.org/viewvc?rev=825328&view=rev
Log:
merge up to r825291

Modified:
    lucene/java/branches/flex_1458/   (props changed)
    lucene/java/branches/flex_1458/CHANGES.txt
    lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java
    lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java
    lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
    lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java
    lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/IndexMergeTool.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocInverterPerField.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriterThreadState.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MergePolicy.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictReader.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestDateTools.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestNumberTools.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java   (props changed)
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCrash.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestThreadedOptimize.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPositionIncrement.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java

Propchange: lucene/java/branches/flex_1458/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 14 22:56:29 2009
@@ -1,4 +1,4 @@
 /lucene/java/branches/lucene_2_4:748824
 /lucene/java/branches/lucene_2_9:817269-818600
 /lucene/java/branches/lucene_2_9_back_compat_tests:818601-821336
-/lucene/java/trunk:824912-825114
+/lucene/java/trunk:824912-825292

Modified: lucene/java/branches/flex_1458/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/CHANGES.txt?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/CHANGES.txt (original)
+++ lucene/java/branches/flex_1458/CHANGES.txt Wed Oct 14 22:56:29 2009
@@ -73,7 +73,7 @@
 * LUCENE-944: Remove deprecated methods in BooleanQuery. (Michael Busch)
 
 * LUCENE-1979: Remove remaining deprecations from indexer package.
-  (Michael Busch)
+  (Uwe Schindler, Michael Busch)
 
 Bug fixes
 

Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermEnum.java Wed Oct 14 22:56:29 2009
@@ -77,36 +77,6 @@
   public void close() {
   }
 
-
-  public boolean skipTo(Term target) throws IOException {
-
-    // this method is not known to be used by anything
-    // in lucene for many years now, so there is
-    // very to gain by optimizing this method more,
-
-    if (reader.getIndex().getOrderedTerms().length == 0) {
-      return false;
-    }
-
-    InstantiatedTerm term = reader.getIndex().findTerm(target);
-    if (term != null) {
-      this.term = term;
-      nextTermIndex = term.getTermIndex() + 1;
-      return true;
-    } else {
-      int pos = Arrays.binarySearch(reader.getIndex().getOrderedTerms(), target, InstantiatedTerm.termComparator);
-      if (pos < 0) {
-        pos = -1 - pos;
-      }
-
-      if (pos > reader.getIndex().getOrderedTerms().length) {
-        return false;
-      }
-      this.term = reader.getIndex().getOrderedTerms()[pos];
-      nextTermIndex = pos + 1;
-      return true;
-    }
-  }
 }
 
 

Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java Wed Oct 14 22:56:29 2009
@@ -105,7 +105,6 @@
 
     assertNull(terms.term());
     assertFalse(terms.next());
-    assertFalse(terms.skipTo(new Term("foo", "bar")));
 
   }
 

Modified: lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (original)
+++ lucene/java/branches/flex_1458/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java Wed Oct 14 22:56:29 2009
@@ -391,42 +391,6 @@
       }
     }
 
-    // compare term enumeration seeking
-
-    aprioriTermEnum = aprioriReader.terms();
-
-    TermEnum aprioriTermEnumSeeker = aprioriReader.terms();
-    TermEnum testTermEnumSeeker = testReader.terms();
-
-    while (aprioriTermEnum.next()) {
-      if (aprioriTermEnumSeeker.skipTo(aprioriTermEnum.term())) {
-        assertTrue(testTermEnumSeeker.skipTo(aprioriTermEnum.term()));
-        assertEquals(aprioriTermEnumSeeker.term(), testTermEnumSeeker.term());
-      } else {
-        assertFalse(testTermEnumSeeker.skipTo(aprioriTermEnum.term()));
-      }
-    }
-
-    aprioriTermEnum.close();
-    aprioriTermEnumSeeker.close();
-    testTermEnumSeeker.close();
-
-    // skip to non existing terms
-
-    aprioriTermEnumSeeker = aprioriReader.terms();
-    testTermEnumSeeker = testReader.terms();
-
-    aprioriTermEnum = aprioriReader.terms();
-    aprioriTermEnum.next();
-    Term nonExistingTerm = new Term(aprioriTermEnum.term().field(), "bzzzzoo993djdj380sdf");
-    aprioriTermEnum.close();
-
-    assertEquals(aprioriTermEnumSeeker.skipTo(nonExistingTerm), testTermEnumSeeker.skipTo(nonExistingTerm));
-    assertEquals(aprioriTermEnumSeeker.term(), testTermEnumSeeker.term());
-
-    aprioriTermEnumSeeker.close();
-    testTermEnumSeeker.close();
-
     // compare term vectors and position vectors
 
     for (int documentNumber = 0; documentNumber < aprioriReader.numDocs(); documentNumber++) {

Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/TermVectorAccessor.java Wed Oct 14 22:56:29 2009
@@ -115,7 +115,7 @@
           int docID = docs.advance(documentNumber);
           if (docID == documentNumber) {
 
-            frequencies.add(new Integer(docs.freq()));
+            frequencies.add(Integer.valueOf(docs.freq()));
             tokens.add(text.toString());
 
             if (!mapper.isIgnoringPositions()) {

Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/IndexMergeTool.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/IndexMergeTool.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/IndexMergeTool.java (original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/misc/IndexMergeTool.java Wed Oct 14 22:56:29 2009
@@ -45,7 +45,7 @@
     }
 
     System.out.println("Merging...");
-    writer.addIndexes(indexes);
+    writer.addIndexesNoOptimize(indexes);
 
     System.out.println("Optimizing...");
     writer.optimize();

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/CheckIndex.java Wed Oct 14 22:56:29 2009
@@ -50,11 +50,6 @@
  */
 public class CheckIndex {
 
-  /** Default PrintStream for all CheckIndex instances.
-   *  @deprecated Use {@link #setInfoStream} per instance,
-   *  instead. */
-  public static PrintStream out = null;
-
   private PrintStream infoStream;
   private Directory dir;
 
@@ -259,7 +254,7 @@
   /** Create a new CheckIndex on the directory. */
   public CheckIndex(Directory dir) {
     this.dir = dir;
-    infoStream = out;
+    infoStream = null;
   }
 
   /** Set infoStream where messages should go.  If null, no

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DirectoryReader.java Wed Oct 14 22:56:29 2009
@@ -666,7 +666,6 @@
     return false;
   }
 
-  private byte[] ones;
   public synchronized byte[] norms(String field) throws IOException {
     ensureOpen();
     byte[] bytes = (byte[])normsCache.get(field);

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocInverterPerField.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocInverterPerField.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocInverterPerField.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocInverterPerField.java Wed Oct 14 22:56:29 2009
@@ -129,9 +129,6 @@
 
           final int startLength = fieldState.length;
           
-          // deprecated
-          final boolean allowMinus1Position = docState.allowMinus1Position;
-
           try {
             int offsetEnd = fieldState.offset-1;
             
@@ -157,7 +154,7 @@
               
               final int posIncr = posIncrAttribute.getPositionIncrement();
               fieldState.position += posIncr;
-              if (allowMinus1Position || fieldState.position > 0) {
+              if (fieldState.position > 0) {
                 fieldState.position--;
               }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriter.java Wed Oct 14 22:56:29 2009
@@ -152,9 +152,6 @@
     Document doc;
     String maxTermPrefix;
 
-    // deprecated
-    boolean allowMinus1Position;
-
     // Only called by asserts
     public boolean testPoint(String name) {
       return docWriter.writer.testPoint(name);
@@ -301,11 +298,6 @@
       threadStates[i].docState.similarity = similarity;
   }
 
-  synchronized void setAllowMinus1Position() {
-    for(int i=0;i<threadStates.length;i++)
-      threadStates[i].docState.allowMinus1Position = true;
-  }
-
   /** Set how much RAM we can use before flushing. */
   synchronized void setRAMBufferSizeMB(double mb) {
     if (mb == IndexWriter.DISABLE_AUTO_FLUSH) {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriterThreadState.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriterThreadState.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriterThreadState.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocumentsWriterThreadState.java Wed Oct 14 22:56:29 2009
@@ -40,7 +40,6 @@
     docState.infoStream = docWriter.infoStream;
     docState.similarity = docWriter.similarity;
     docState.docWriter = docWriter;
-    docState.allowMinus1Position = docWriter.writer.getAllowMinus1Position();
     consumer = docWriter.consumer.addThread(this);
   }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/FilterIndexReader.java Wed Oct 14 22:56:29 2009
@@ -221,9 +221,6 @@
 
   protected void doDelete(int n) throws  CorruptIndexException, IOException { in.deleteDocument(n); }
   
-  /** @deprecated */
-  protected void doCommit() throws IOException { doCommit(null); }
-  
   protected void doCommit(Map commitUserData) throws IOException { in.commit(commitUserData); }
   
   protected void doClose() throws IOException { in.close(); }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexReader.java Wed Oct 14 22:56:29 2009
@@ -124,8 +124,6 @@
 
   static int DEFAULT_TERMS_INDEX_DIVISOR = 1;
 
-  private boolean disableFakeNorms = false;
-
   /** Expert: returns the current refCount for this reader */
   public synchronized int getRefCount() {
     return refCount;
@@ -563,37 +561,6 @@
     throw new UnsupportedOperationException("This reader does not support this method.");
   }
 
-  /**<p>For IndexReader implementations that use
-   * TermInfosReader to read terms, this sets the
-   * indexDivisor to subsample the number of indexed terms
-   * loaded into memory.  This has the same effect as {@link
-   * IndexWriter#setTermIndexInterval} except that setting
-   * must be done at indexing time while this setting can be
-   * set per reader.  When set to N, then one in every
-   * N*termIndexInterval terms in the index is loaded into
-   * memory.  By setting this to a value > 1 you can reduce
-   * memory usage, at the expense of higher latency when
-   * loading a TermInfo.  The default value is 1.</p>
-   *
-   * <b>NOTE:</b> you must call this before the term
-   * index is loaded.  If the index is already loaded, 
-   * an IllegalStateException is thrown.
-   * @throws IllegalStateException if the term index has already been loaded into memory
-   * @deprecated Please use {@link IndexReader#open(Directory, IndexDeletionPolicy, boolean, int)} to specify the required TermInfos index divisor instead.
-   */
-  public void setTermInfosIndexDivisor(int indexDivisor) throws IllegalStateException {
-    throw new UnsupportedOperationException("Please pass termInfosIndexDivisor up-front when opening IndexReader");
-  }
-
-  /** <p>For IndexReader implementations that use
-   *  TermInfosReader to read terms, this returns the
-   *  current indexDivisor as specified when the reader was
-   *  opened.
-   */
-  public int getTermInfosIndexDivisor() {
-    throw new UnsupportedOperationException("This reader does not support this method.");
-  }
-
   /**
    * Check whether this IndexReader is still using the
    * current (i.e., most recently committed) version of the

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/IndexWriter.java Wed Oct 14 22:56:29 2009
@@ -182,12 +182,6 @@
   public static final String WRITE_LOCK_NAME = "write.lock";
 
   /**
-   * @deprecated
-   * @see LogMergePolicy#DEFAULT_MERGE_FACTOR
-   */
-  public final static int DEFAULT_MERGE_FACTOR = LogMergePolicy.DEFAULT_MERGE_FACTOR;
-
-  /**
    * Value to denote a flush trigger is disabled
    */
   public final static int DISABLE_AUTO_FLUSH = -1;
@@ -211,12 +205,6 @@
   public final static int DEFAULT_MAX_BUFFERED_DELETE_TERMS = DISABLE_AUTO_FLUSH;
 
   /**
-   * @deprecated
-   * @see LogDocMergePolicy#DEFAULT_MAX_MERGE_DOCS
-   */
-  public final static int DEFAULT_MAX_MERGE_DOCS = LogDocMergePolicy.DEFAULT_MAX_MERGE_DOCS;
-
-  /**
    * Default value is 10,000. Change using {@link #setMaxFieldLength(int)}.
    */
   public final static int DEFAULT_MAX_FIELD_LENGTH = 10000;
@@ -313,12 +301,12 @@
   private volatile boolean poolReaders;
   
   /**
-   * Returns a readonly reader, covering all committed as
-   * well as un-committed changes to the index.  This
-   * provides "near real-time" searching, in that changes
-   * made during an IndexWriter session can be quickly made
-   * available for searching without closing the writer nor
-   * calling {@link #commit}.
+   * Expert: returns a readonly reader, covering all
+   * committed as well as un-committed changes to the index.
+   * This provides "near real-time" searching, in that
+   * changes made during an IndexWriter session can be
+   * quickly made available for searching without closing
+   * the writer nor calling {@link #commit}.
    *
    * <p>Note that this is functionally equivalent to calling
    * {#commit} and then using {@link IndexReader#open} to
@@ -1801,16 +1789,6 @@
     return analyzer;
   }
 
-  /** Returns the number of documents currently in this
-   *  index, not counting deletions.
-   * @deprecated Please use {@link #maxDoc()} (same as this
-   * method) or {@link #numDocs()} (also takes deletions
-   * into account), instead. */
-  public synchronized int docCount() {
-    ensureOpen();
-    return maxDoc();
-  }
-
   /** Returns total number of docs in this index, including
    *  docs not yet flushed (still in the RAM buffer),
    *  not counting deletions.
@@ -2005,14 +1983,14 @@
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
    */
-  public void deleteDocuments(Term[] terms) throws CorruptIndexException, IOException {
+  public void deleteDocuments(Term... terms) throws CorruptIndexException, IOException {
     ensureOpen();
     try {
       boolean doFlush = docWriter.bufferDeleteTerms(terms);
       if (doFlush)
         flush(true, false, false);
     } catch (OutOfMemoryError oom) {
-      handleOOM(oom, "deleteDocuments(Term[])");
+      handleOOM(oom, "deleteDocuments(Term..)");
     }
   }
 
@@ -2047,7 +2025,7 @@
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
    */
-  public void deleteDocuments(Query[] queries) throws CorruptIndexException, IOException {
+  public void deleteDocuments(Query... queries) throws CorruptIndexException, IOException {
     ensureOpen();
     boolean doFlush = docWriter.bufferDeleteQueries(queries);
     if (doFlush)
@@ -2704,13 +2682,6 @@
   }
 
   /**
-   * @deprecated Please use {@link #rollback} instead.
-   */
-  public void abort() throws IOException {
-    rollback();
-  }
-
-  /**
    * Close the <code>IndexWriter</code> without committing
    * any changes that have occurred since the last commit
    * (or since it was opened, if commit hasn't been called).
@@ -2957,84 +2928,12 @@
     releaseRead();
   }
 
-  /** Merges all segments from an array of indexes into this index.
-   *
-   * <p><b>NOTE</b>: if this method hits an OutOfMemoryError
-   * you should immediately close the writer.  See <a
-   * href="#OOME">above</a> for details.</p>
-   *
-   * @deprecated Use {@link #addIndexesNoOptimize} instead,
-   * then separately call {@link #optimize} afterwards if
-   * you need to.
-   *
-   * @throws CorruptIndexException if the index is corrupt
-   * @throws IOException if there is a low-level IO error
-   */
-  public void addIndexes(Directory[] dirs)
-    throws CorruptIndexException, IOException {
-
-    ensureOpen();
-    
-    noDupDirs(dirs);
-
-    // Do not allow add docs or deletes while we are running:
-    docWriter.pauseAllThreads();
-
-    try {
-
-      if (infoStream != null)
-        message("flush at addIndexes");
-      flush(true, false, true);
-
-      boolean success = false;
-
-      startTransaction(false);
-
-      try {
-
-        int docCount = 0;
-        synchronized(this) {
-          ensureOpen();
-          for (int i = 0; i < dirs.length; i++) {
-            SegmentInfos sis = new SegmentInfos();	  // read infos from dir
-            sis.read(dirs[i], codecs);
-            for (int j = 0; j < sis.size(); j++) {
-              final SegmentInfo info = sis.info(j);
-              docCount += info.docCount;
-              assert !segmentInfos.contains(info);
-              segmentInfos.add(info);	  // add each info
-            }
-          }
-        }
-
-        // Notify DocumentsWriter that the flushed count just increased
-        docWriter.updateFlushedDocCount(docCount);
-
-        optimize();
-
-        success = true;
-      } finally {
-        if (success) {
-          commitTransaction();
-        } else {
-          rollbackTransaction();
-        }
-      }
-    } catch (OutOfMemoryError oom) {
-      handleOOM(oom, "addIndexes(Directory[])");
-    } finally {
-      if (docWriter != null) {
-        docWriter.resumeAllThreads();
-      }
-    }
-  }
-
   private synchronized void resetMergeExceptions() {
     mergeExceptions = new ArrayList();
     mergeGen++;
   }
 
-  private void noDupDirs(Directory[] dirs) {
+  private void noDupDirs(Directory... dirs) {
     HashSet dups = new HashSet();
     for(int i=0;i<dirs.length;i++) {
       if (dups.contains(dirs[i]))
@@ -3095,7 +2994,7 @@
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
    */
-  public void addIndexesNoOptimize(Directory[] dirs)
+  public void addIndexesNoOptimize(Directory... dirs)
       throws CorruptIndexException, IOException {
 
     ensureOpen();
@@ -3258,7 +3157,7 @@
    * add or delete documents (with another thread) will be
    * paused until this method completes.
    *
-   * <p>See {@link #addIndexesNoOptimize(Directory[])} for
+   * <p>See {@link #addIndexesNoOptimize} for
    * details on transactional semantics, temporary free
    * space required in the Directory, and non-CFS segments
    * on an Exception.</p>
@@ -3270,7 +3169,7 @@
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
    */
-  public void addIndexes(IndexReader[] readers)
+  public void addIndexes(IndexReader... readers)
     throws CorruptIndexException, IOException {
 
     ensureOpen();
@@ -3310,8 +3209,7 @@
       // call hits an exception it will release the write
       // lock:
       startTransaction(true);
-      success = false;
-      
+
       try {
         mergedName = newSegmentName();
         merger = new SegmentMerger(this, mergedName, null, codecs);
@@ -3338,7 +3236,7 @@
             segmentInfos.clear();                      // pop old infos & add new
             info = new SegmentInfo(mergedName, docCount, directory, false, true,
                                    -1, null, false, merger.hasProx(), merger.getCodec());
-            setDiagnostics(info, "addIndexes(IndexReader[])");
+            setDiagnostics(info, "addIndexes(IndexReader...)");
             segmentInfos.add(info);
           }
 
@@ -3407,7 +3305,7 @@
         }
       }
     } catch (OutOfMemoryError oom) {
-      handleOOM(oom, "addIndexes(IndexReader[])");
+      handleOOM(oom, "addIndexes(IndexReader...)");
     } finally {
       if (docWriter != null) {
         docWriter.resumeAllThreads();
@@ -3930,7 +3828,9 @@
         }
       }
     }
-
+    
+    //nocommit: is this supposed to be here or not?
+    //merge.info.setHasProx(merger.hasProx());
     // mxx
     // System.out.println(Thread.currentThread().getName() + ": finish setHasProx=" + merger.hasProx() + " seg=" + merge.info.name);
 
@@ -4955,22 +4855,6 @@
     throw oom;
   }
 
-  // deprecated
-  private boolean allowMinus1Position;
-
-  /** Deprecated: emulates IndexWriter's buggy behavior when
-   *  first token(s) have positionIncrement==0 (ie, prior to
-   *  fixing LUCENE-1542) */
-  public void setAllowMinus1Position() {
-    allowMinus1Position = true;
-    docWriter.setAllowMinus1Position();
-  }
-
-  // deprecated
-  boolean getAllowMinus1Position() {
-    return allowMinus1Position;
-  }
-
   // Used only by assert for testing.  Current points:
   //   startDoFlush
   //   startCommitMerge

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MergePolicy.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MergePolicy.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/MergePolicy.java Wed Oct 14 22:56:29 2009
@@ -172,20 +172,12 @@
    *  executing a merge. */
   public static class MergeException extends RuntimeException {
     private Directory dir;
-    /** @deprecated
-     *  Use {@link #MergePolicy.MergeException(String,Directory)} instead */
-    public MergeException(String message) {
-      super(message);
-    }
+
     public MergeException(String message, Directory dir) {
       super(message);
       this.dir = dir;
     }
-    /** @deprecated
-     *  Use {@link #MergePolicy.MergeException(Throwable,Directory)} instead */
-    public MergeException(Throwable exc) {
-      super(exc);
-    }
+
     public MergeException(Throwable exc, Directory dir) {
       super(exc);
       this.dir = dir;

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/ParallelReader.java Wed Oct 14 22:56:29 2009
@@ -497,11 +497,6 @@
     return (IndexReader[]) readers.toArray(new IndexReader[readers.size()]);
   }
 
-  /** @deprecated */
-  protected void doCommit() throws IOException {
-    doCommit(null);
-  }
-
   protected void doCommit(Map commitUserData) throws IOException {
     for (int i = 0; i < readers.size(); i++)
       ((IndexReader)readers.get(i)).commit(commitUserData);

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java Wed Oct 14 22:56:29 2009
@@ -781,11 +781,6 @@
     return clone;
   }
 
-  /** @deprecated  */
-  protected void doCommit() throws IOException {
-    doCommit(null);
-  }
-
   protected void doCommit(Map commitUserData) throws IOException {
     if (hasChanges) {
       if (deletedDocsDirty) {               // re-write deleted

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermEnum.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermEnum.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/TermEnum.java Wed Oct 14 22:56:29 2009
@@ -37,29 +37,4 @@
 
   /** Closes the enumeration to further activity, freeing resources. */
   public abstract void close() throws IOException;
-  
-  /** Skips terms to the first beyond the current whose value is
-   * greater or equal to <i>target</i>. <p>Returns true iff there is such
-   * an entry.  <p>Behaves as if written: <pre>
-   *   public boolean skipTo(Term target) {
-   *     do {
-   *       if (!next())
-   * 	     return false;
-   *     } while (target > term());
-   *     return true;
-   *   }
-   * </pre>
-   * Some implementations *could* be considerably more efficient than a linear scan.
-   * Check the implementation to be sure.
-   * @deprecated This method is not performant and will be removed in Lucene 3.0.
-   * Use {@link IndexReader#terms(Term)} to create a new TermEnum positioned at a
-   * given term.
-   */
-  public boolean skipTo(Term target) throws IOException {
-     do {
-        if (!next())
-  	        return false;
-     } while (target.compareTo(term()) > 0);
-     return true;
-  }
 }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardTermsDictReader.java Wed Oct 14 22:56:29 2009
@@ -19,9 +19,12 @@
 
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeMap;
 
 import org.apache.lucene.index.DocsEnum;
@@ -189,7 +192,7 @@
   private class FieldReader extends Terms {
     private final CloseableThreadLocal threadResources = new CloseableThreadLocal();
     // nocommit: check placement
-
+    Collection<ThreadResources> threadResourceSet = new HashSet<ThreadResources>();
     final long numTerms;
     final FieldInfo fieldInfo;
     final long termsStartPointer;
@@ -205,6 +208,9 @@
 
     public void close() {
       threadResources.close();
+      for(ThreadResources threadResource : threadResourceSet) {
+        threadResource.termInfoCache = null;
+      }
     }
     
     private ThreadResources getThreadResources() {
@@ -213,6 +219,7 @@
         resources = new ThreadResources();
         // Cache does not have to be thread-safe, it is only used by one thread at the same time
         resources.termInfoCache = new ReuseLRUCache(1024);
+        threadResourceSet.add(resources);
         threadResources.set(resources);
       }
       return resources;
@@ -225,7 +232,7 @@
     public long getUniqueTermCount() {
       return numTerms;
     }
-
+    ThreadResources resources = getThreadResources();
     // Iterates through terms in this field
     private class SegmentTermsEnum extends TermsEnum {
       private final IndexInput in;
@@ -235,7 +242,7 @@
       private final DocsProducer.Reader docs;
       private int docFreq;
       private final StandardTermsIndexReader.TermsIndexResult indexResult = new StandardTermsIndexReader.TermsIndexResult();
-      ThreadResources resources = getThreadResources();
+
       
       SegmentTermsEnum() throws IOException {
         if (Codec.DEBUG) {
@@ -491,6 +498,17 @@
       return remove;
     }
     
+    @Override
+    public synchronized Object put(Object key, Object value) {
+      // TODO Auto-generated method stub
+      return super.put(key, value);
+    }
+    
+    @Override
+    public synchronized Object get(Object key) {
+      // TODO Auto-generated method stub
+      return super.get(key);
+    }
   }
 
 }

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 14 22:56:29 2009
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:748824
-/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:824912-825114
+/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:824912-825292

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestDateTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 14 22:56:29 2009
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/document/TestDateTools.java:748824
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:824912-825114
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:824912-825292

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/document/TestNumberTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 14 22:56:29 2009
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/document/TestNumberTools.java:748824
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:824912-825114
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:824912-825292

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java Wed Oct 14 22:56:29 2009
@@ -44,7 +44,7 @@
     writer = newWriter(dir, true);
     // add 100 documents
     addDocs(writer, 100);
-    assertEquals(100, writer.docCount());
+    assertEquals(100, writer.maxDoc());
     writer.close();
     _TestUtil.checkIndex(dir);
 
@@ -52,20 +52,20 @@
     writer.setUseCompoundFile(false); // use one without a compound file
     // add 40 documents in separate files
     addDocs(writer, 40);
-    assertEquals(40, writer.docCount());
+    assertEquals(40, writer.maxDoc());
     writer.close();
 
     writer = newWriter(aux2, true);
     // add 40 documents in compound files
     addDocs2(writer, 50);
-    assertEquals(50, writer.docCount());
+    assertEquals(50, writer.maxDoc());
     writer.close();
 
     // test doc count before segments are merged
     writer = newWriter(dir, false);
-    assertEquals(100, writer.docCount());
+    assertEquals(100, writer.maxDoc());
     writer.addIndexesNoOptimize(new Directory[] { aux, aux2 });
-    assertEquals(190, writer.docCount());
+    assertEquals(190, writer.maxDoc());
     writer.close();
     _TestUtil.checkIndex(dir);
 
@@ -80,14 +80,14 @@
     writer = newWriter(aux3, true);
     // add 40 documents
     addDocs(writer, 40);
-    assertEquals(40, writer.docCount());
+    assertEquals(40, writer.maxDoc());
     writer.close();
 
     // test doc count before segments are merged/index is optimized
     writer = newWriter(dir, false);
-    assertEquals(190, writer.docCount());
+    assertEquals(190, writer.maxDoc());
     writer.addIndexesNoOptimize(new Directory[] { aux3 });
-    assertEquals(230, writer.docCount());
+    assertEquals(230, writer.maxDoc());
     writer.close();
 
     // make sure the new index is correct
@@ -116,9 +116,9 @@
     writer.close();
 
     writer = newWriter(dir, false);
-    assertEquals(230, writer.docCount());
+    assertEquals(230, writer.maxDoc());
     writer.addIndexesNoOptimize(new Directory[] { aux4 });
-    assertEquals(231, writer.docCount());
+    assertEquals(231, writer.maxDoc());
     writer.close();
 
     verifyNumDocs(dir, 231);
@@ -254,7 +254,7 @@
     writer = newWriter(dir, true);
     // add 100 documents
     addDocs(writer, 100);
-    assertEquals(100, writer.docCount());
+    assertEquals(100, writer.maxDoc());
     writer.close();
 
     writer = newWriter(aux, true);
@@ -276,7 +276,7 @@
       assertTrue(false);
     }
     catch (IllegalArgumentException e) {
-      assertEquals(100, writer.docCount());
+      assertEquals(100, writer.maxDoc());
     }
     writer.close();
 
@@ -301,7 +301,7 @@
     addDocs(writer, 10);
 
     writer.addIndexesNoOptimize(new Directory[] { aux });
-    assertEquals(1040, writer.docCount());
+    assertEquals(1040, writer.maxDoc());
     assertEquals(2, writer.getSegmentCount());
     assertEquals(1000, writer.getDocCount(0));
     writer.close();
@@ -325,7 +325,7 @@
     addDocs(writer, 2);
 
     writer.addIndexesNoOptimize(new Directory[] { aux });
-    assertEquals(1032, writer.docCount());
+    assertEquals(1032, writer.maxDoc());
     assertEquals(2, writer.getSegmentCount());
     assertEquals(1000, writer.getDocCount(0));
     writer.close();
@@ -348,7 +348,7 @@
     writer.setMergeFactor(4);
 
     writer.addIndexesNoOptimize(new Directory[] { aux, new RAMDirectory(aux) });
-    assertEquals(1060, writer.docCount());
+    assertEquals(1060, writer.maxDoc());
     assertEquals(1000, writer.getDocCount(0));
     writer.close();
 
@@ -377,7 +377,7 @@
     writer.setMergeFactor(4);
 
     writer.addIndexesNoOptimize(new Directory[] { aux, new RAMDirectory(aux) });
-    assertEquals(1020, writer.docCount());
+    assertEquals(1020, writer.maxDoc());
     assertEquals(1000, writer.getDocCount(0));
     writer.close();
 
@@ -399,7 +399,7 @@
     writer.setMaxBufferedDocs(100);
     writer.setMergeFactor(10);
     writer.addIndexesNoOptimize(new Directory[] { aux });
-    assertEquals(30, writer.docCount());
+    assertEquals(30, writer.maxDoc());
     assertEquals(3, writer.getSegmentCount());
     writer.close();
 
@@ -422,7 +422,7 @@
     writer.setMergeFactor(4);
 
     writer.addIndexesNoOptimize(new Directory[] { aux, aux2 });
-    assertEquals(1025, writer.docCount());
+    assertEquals(1025, writer.maxDoc());
     assertEquals(1000, writer.getDocCount(0));
     writer.close();
 
@@ -480,7 +480,7 @@
     writer.setMaxBufferedDocs(1000);
     // add 1000 documents in 1 segment
     addDocs(writer, 1000);
-    assertEquals(1000, writer.docCount());
+    assertEquals(1000, writer.maxDoc());
     assertEquals(1, writer.getSegmentCount());
     writer.close();
 
@@ -497,7 +497,7 @@
       writer.setMaxBufferedDocs(100);
       writer.setMergeFactor(10);
     }
-    assertEquals(30, writer.docCount());
+    assertEquals(30, writer.maxDoc());
     assertEquals(3, writer.getSegmentCount());
     writer.close();
   }

Propchange: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Oct 14 22:56:29 2009
@@ -1,2 +1,2 @@
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:748824
-/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:824912-825114
+/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:824912-825292

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCrash.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCrash.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCrash.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestCrash.java Wed Oct 14 22:56:29 2009
@@ -82,7 +82,7 @@
     MockRAMDirectory dir = (MockRAMDirectory) writer.getDirectory();
     writer.close();
     writer = initIndex(dir);
-    assertEquals(314, writer.docCount());
+    assertEquals(314, writer.maxDoc());
     crash(writer);
 
     /*

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReader.java Wed Oct 14 22:56:29 2009
@@ -1748,7 +1748,7 @@
       // expected
     }
 
-    assertEquals(-1, r.getTermInfosIndexDivisor());
+    assertEquals(-1, ((SegmentReader) r.getSequentialSubReaders()[0]).getTermInfosIndexDivisor());
     writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
     writer.addDocument(doc);
     writer.close();

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java Wed Oct 14 22:56:29 2009
@@ -119,7 +119,8 @@
         IndexWriter.MaxFieldLength.LIMITED);
     iw.setMaxBufferedDocs(5);
     iw.setMergeFactor(3);
-    iw.addIndexes(new Directory[] { dir1, dir2 });
+    iw.addIndexesNoOptimize(new Directory[] { dir1, dir2 });
+    iw.optimize();
     iw.close();
 
     norms1.addAll(norms);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriter.java Wed Oct 14 22:56:29 2009
@@ -98,7 +98,7 @@
         for (i = 0; i < 100; i++) {
             addDoc(writer);
         }
-        assertEquals(100, writer.docCount());
+        assertEquals(100, writer.maxDoc());
         writer.close();
 
         // delete 40 documents
@@ -110,7 +110,7 @@
 
         // test doc count before segments are merged/index is optimized
         writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
-        assertEquals(100, writer.docCount());
+        assertEquals(100, writer.maxDoc());
         writer.close();
 
         reader = IndexReader.open(dir, true);
@@ -158,7 +158,7 @@
 
     /*
       Test: make sure when we run out of disk space or hit
-      random IOExceptions in any of the addIndexes(*) calls
+      random IOExceptions in any of the addIndexesNoOptimize(*) calls
       that 1) index is not corrupt (searcher can open/search
       it) and 2) transactional semantics are followed:
       either all or none of the incoming documents were in
@@ -173,7 +173,7 @@
       boolean debug = false;
 
       // Build up a bunch of dirs that have indexes which we
-      // will then merge together by calling addIndexes(*):
+      // will then merge together by calling addIndexesNoOptimize(*):
       Directory[] dirs = new Directory[NUM_DIR];
       long inputDiskUsage = 0;
       for(int i=0;i<NUM_DIR;i++) {
@@ -190,7 +190,7 @@
       }
 
       // Now, build a starting index that has START_COUNT docs.  We
-      // will then try to addIndexes into a copy of this:
+      // will then try to addIndexesNoOptimize into a copy of this:
       RAMDirectory startDir = new RAMDirectory();
       IndexWriter writer = new IndexWriter(startDir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
       for(int j=0;j<START_COUNT;j++) {
@@ -211,12 +211,12 @@
 
       // Iterate with larger and larger amounts of free
       // disk space.  With little free disk space,
-      // addIndexes will certainly run out of space &
+      // addIndexesNoOptimize will certainly run out of space &
       // fail.  Verify that when this happens, index is
       // not corrupt and index in fact has added no
       // documents.  Then, we increase disk space by 2000
       // bytes each iteration.  At some point there is
-      // enough free disk space and addIndexes should
+      // enough free disk space and addIndexesNoOptimize should
       // succeed and index should show all documents were
       // added.
 
@@ -244,7 +244,7 @@
 
         String methodName;
         if (0 == method) {
-          methodName = "addIndexes(Directory[])";
+          methodName = "addIndexes(Directory[]) + optimize()";
         } else if (1 == method) {
           methodName = "addIndexes(IndexReader[])";
         } else {
@@ -308,7 +308,8 @@
             try {
 
               if (0 == method) {
-                writer.addIndexes(dirs);
+                writer.addIndexesNoOptimize(dirs);
+                writer.optimize();
               } else if (1 == method) {
                 IndexReader readers[] = new IndexReader[dirs.length];
                 for(int i=0;i<dirs.length;i++) {
@@ -490,7 +491,7 @@
 
           if (hitError) {
             if (doAbort) {
-              writer.abort();
+              writer.rollback();
             } else {
               try {
                 writer.close();
@@ -740,7 +741,7 @@
 
           // now open index for create:
           writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-          assertEquals("should be zero documents", writer.docCount(), 0);
+          assertEquals("should be zero documents", writer.maxDoc(), 0);
           addDoc(writer);
           writer.close();
 
@@ -1000,9 +1001,9 @@
       searcher.close();
 
       // Now, close the writer:
-      writer.abort();
+      writer.rollback();
 
-      assertNoUnreferencedFiles(dir, "unreferenced files remain after abort()");
+      assertNoUnreferencedFiles(dir, "unreferenced files remain after rollback()");
 
       searcher = new IndexSearcher(dir, false);
       hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
@@ -1084,7 +1085,7 @@
 
     /*
      * Verify that calling optimize when writer is open for
-     * "commit on close" works correctly both for abort()
+     * "commit on close" works correctly both for rollback()
      * and close().
      */
     public void testCommitOnCloseOptimize() throws IOException {
@@ -1108,7 +1109,7 @@
       reader.close();
 
       // Abort the writer:
-      writer.abort();
+      writer.rollback();
       assertNoUnreferencedFiles(dir, "aborted writer after optimize");
 
       // Open a reader after aborting writer:
@@ -2474,25 +2475,25 @@
   }
 
   // LUCENE-1130: make sure initial IOException, and then 2nd
-  // IOException during abort(), is OK:
+  // IOException during rollback(), is OK:
   public void testIOExceptionDuringAbort() throws IOException {
     _testSingleThreadFailure(new FailOnlyOnAbortOrFlush(false));
   }
 
   // LUCENE-1130: make sure initial IOException, and then 2nd
-  // IOException during abort(), is OK:
+  // IOException during rollback(), is OK:
   public void testIOExceptionDuringAbortOnlyOnce() throws IOException {
     _testSingleThreadFailure(new FailOnlyOnAbortOrFlush(true));
   }
 
   // LUCENE-1130: make sure initial IOException, and then 2nd
-  // IOException during abort(), with multiple threads, is OK:
+  // IOException during rollback(), with multiple threads, is OK:
   public void testIOExceptionDuringAbortWithThreads() throws Exception {
     _testMultipleThreadsFailure(new FailOnlyOnAbortOrFlush(false));
   }
 
   // LUCENE-1130: make sure initial IOException, and then 2nd
-  // IOException during abort(), with multiple threads, is OK:
+  // IOException during rollback(), with multiple threads, is OK:
   public void testIOExceptionDuringAbortWithThreadsOnlyOnce() throws Exception {
     _testMultipleThreadsFailure(new FailOnlyOnAbortOrFlush(true));
   }
@@ -2772,7 +2773,8 @@
       writer.setMergePolicy(new LogDocMergePolicy(writer));
 
       Directory[] indexDirs = {new MockRAMDirectory(dir)};
-      writer.addIndexes(indexDirs);
+      writer.addIndexesNoOptimize(indexDirs);
+      writer.optimize();
       writer.close();
     }
     dir.close();
@@ -3225,7 +3227,7 @@
       // Expected
     }
     assertTrue(failure.fail1 && failure.fail2);
-    w.abort();
+    w.rollback();
     dir.close();
   }
   
@@ -3715,7 +3717,8 @@
     void doBody(int j, Directory[] dirs) throws Throwable {
       switch(j%4) {
       case 0:
-        writer2.addIndexes(dirs);
+        writer2.addIndexesNoOptimize(dirs);
+        writer2.optimize();
         break;
       case 1:
         writer2.addIndexesNoOptimize(dirs);
@@ -3801,7 +3804,8 @@
     void doBody(int j, Directory[] dirs) throws Throwable {
       switch(j%5) {
       case 0:
-        writer2.addIndexes(dirs);
+        writer2.addIndexesNoOptimize(dirs);
+        writer2.optimize();
         break;
       case 1:
         writer2.addIndexesNoOptimize(dirs);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java Wed Oct 14 22:56:29 2009
@@ -198,7 +198,7 @@
     ((ConcurrentMergeScheduler) writer.getMergeScheduler()).sync();
     writer.commit();
     checkInvariants(writer);
-    assertEquals(10, writer.docCount());
+    assertEquals(10, writer.maxDoc());
 
     writer.close();
   }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterMerging.java Wed Oct 14 22:56:29 2009
@@ -29,7 +29,7 @@
 {
 
   /**
-   * Tests that index merging (specifically addIndexes()) doesn't
+   * Tests that index merging (specifically addIndexesNoOptimize()) doesn't
    * change the index order of documents.
    */
   public void testLucene() throws IOException
@@ -59,7 +59,8 @@
     IndexWriter writer = new IndexWriter(merged, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
     writer.setMergeFactor(2);
 
-    writer.addIndexes(new Directory[]{indexA, indexB});
+    writer.addIndexesNoOptimize(new Directory[]{indexA, indexB});
+    writer.optimize();
     writer.close();
 
     fail = verifyIndex(merged, 0);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestIndexWriterReader.java Wed Oct 14 22:56:29 2009
@@ -428,7 +428,8 @@
     void doBody(int j, Directory[] dirs) throws Throwable {
       switch (j % 4) {
         case 0:
-          mainWriter.addIndexes(dirs);
+          mainWriter.addIndexesNoOptimize(dirs);
+          mainWriter.optimize();
           break;
         case 1:
           mainWriter.addIndexesNoOptimize(dirs);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestNorms.java Wed Oct 14 22:56:29 2009
@@ -37,7 +37,7 @@
 
 /**
  * Test that norms info is preserved during index life - including
- * separate norms, addDocument, addIndexes, optimize.
+ * separate norms, addDocument, addIndexesNoOptimize, optimize.
  */
 public class TestNorms extends LuceneTestCase {
 
@@ -107,7 +107,8 @@
     IndexWriter iw = new IndexWriter(dir3,anlzr,false, IndexWriter.MaxFieldLength.LIMITED);
     iw.setMaxBufferedDocs(5);
     iw.setMergeFactor(3);
-    iw.addIndexes(new Directory[]{dir1,dir2});
+    iw.addIndexesNoOptimize(new Directory[]{dir1,dir2});
+    iw.optimize();
     iw.close();
     
     norms1.addAll(norms);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestThreadedOptimize.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestThreadedOptimize.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestThreadedOptimize.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestThreadedOptimize.java Wed Oct 14 22:56:29 2009
@@ -114,7 +114,7 @@
 
       // System.out.println("TEST: now index=" + writer.segString());
 
-      assertEquals(expectedDocCount, writer.docCount());
+      assertEquals(expectedDocCount, writer.maxDoc());
 
       writer.close();
       writer = new IndexWriter(directory, ANALYZER, false, IndexWriter.MaxFieldLength.UNLIMITED);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBoolean2.java Wed Oct 14 22:56:29 2009
@@ -25,9 +25,12 @@
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.store.MockRAMDirectory;
+import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 
 /** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.
@@ -35,8 +38,13 @@
  */
 public class TestBoolean2 extends LuceneTestCase {
   private IndexSearcher searcher;
+  private IndexSearcher bigSearcher;
+  private IndexReader reader;
+  private static int NUM_EXTRA_DOCS = 6000;
 
   public static final String field = "field";
+  private Directory dir2;
+  private int mulFactor;
 
   public void setUp() throws Exception {
     super.setUp();
@@ -49,6 +57,43 @@
     }
     writer.close();
     searcher = new IndexSearcher(directory, true);
+
+    // Make big index
+    dir2 = new MockRAMDirectory(directory);
+
+    // First multiply small test index:
+    mulFactor = 1;
+    int docCount = 0;
+    do {
+      final Directory copy = new RAMDirectory(dir2);
+      IndexWriter w = new IndexWriter(dir2, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
+      w.addIndexesNoOptimize(new Directory[] {copy});
+      docCount = w.maxDoc();
+      w.close();
+      mulFactor *= 2;
+    } while(docCount < 3000);
+
+    IndexWriter w = new IndexWriter(dir2, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
+    Document doc = new Document();
+    doc.add(new Field("field2", "xxx", Field.Store.NO, Field.Index.ANALYZED));
+    for(int i=0;i<NUM_EXTRA_DOCS/2;i++) {
+      w.addDocument(doc);
+    }
+    doc = new Document();
+    doc.add(new Field("field2", "big bad bug", Field.Store.NO, Field.Index.ANALYZED));
+    for(int i=0;i<NUM_EXTRA_DOCS/2;i++) {
+      w.addDocument(doc);
+    }
+    // optimize to 1 segment
+    w.optimize();
+    reader = w.getReader();
+    w.close();
+    bigSearcher = new IndexSearcher(reader);
+  }
+
+  public void tearDown() throws Exception {
+    reader.close();
+    dir2.close();
   }
 
   private String[] docFields = {
@@ -76,6 +121,9 @@
     collector = TopScoreDocCollector.create(1000, true);
     searcher.search(query2, null, collector);
     ScoreDoc[] hits2 = collector.topDocs().scoreDocs; 
+
+    assertEquals(mulFactor * collector.totalHits,
+                 bigSearcher.search(query1, 1).totalHits);
       
     CheckHits.checkHitsQuery(query2, hits1, hits2, expDocNrs);
   }
@@ -159,7 +207,7 @@
       // increase number of iterations for more complete testing
       for (int i=0; i<1000; i++) {
         int level = rnd.nextInt(3);
-        q1 = randBoolQuery(new Random(rnd.nextLong()), level, field, vals, null);
+        q1 = randBoolQuery(new Random(rnd.nextLong()), rnd.nextBoolean(), level, field, vals, null);
         
         // Can't sort by relevance since floating point numbers may not quite
         // match up.
@@ -180,6 +228,12 @@
         ScoreDoc[] hits2 = collector.topDocs().scoreDocs;
         tot+=hits2.length;
         CheckHits.checkEqual(q1, hits1, hits2);
+
+        BooleanQuery q3 = new BooleanQuery();
+        q3.add(q1, BooleanClause.Occur.SHOULD);
+        q3.add(new PrefixQuery(new Term("field2", "b")), BooleanClause.Occur.SHOULD);
+        TopDocs hits4 = bigSearcher.search(q3, 1);
+        assertEquals(mulFactor*collector.totalHits + NUM_EXTRA_DOCS/2, hits4.totalHits);
       }
 
     } catch (Exception e) {
@@ -200,7 +254,7 @@
 
   // Random rnd is passed in so that the exact same random query may be created
   // more than once.
-  public static BooleanQuery randBoolQuery(Random rnd, int level, String field, String[] vals, Callback cb) {
+  public static BooleanQuery randBoolQuery(Random rnd, boolean allowMust, int level, String field, String[] vals, Callback cb) {
     BooleanQuery current = new BooleanQuery(rnd.nextInt()<0);
     for (int i=0; i<rnd.nextInt(vals.length)+1; i++) {
       int qType=0; // term query
@@ -208,14 +262,28 @@
         qType = rnd.nextInt(10);
       }
       Query q;
-      if (qType < 7) q = new TermQuery(new Term(field, vals[rnd.nextInt(vals.length)]));
-      else q = randBoolQuery(rnd, level-1, field, vals, cb);
+      if (qType < 3) {
+        q = new TermQuery(new Term(field, vals[rnd.nextInt(vals.length)]));
+      } else if (qType < 7) {
+        q = new WildcardQuery(new Term(field, "w*"));
+      } else {
+        q = randBoolQuery(rnd, allowMust, level-1, field, vals, cb);
+      }
 
       int r = rnd.nextInt(10);
       BooleanClause.Occur occur;
-      if (r<2) occur=BooleanClause.Occur.MUST_NOT;
-      else if (r<5) occur=BooleanClause.Occur.MUST;
-      else occur=BooleanClause.Occur.SHOULD;
+      if (r<2) {
+        occur=BooleanClause.Occur.MUST_NOT;
+      }
+      else if (r<5) {
+        if (allowMust) {
+          occur=BooleanClause.Occur.MUST;
+        } else {
+          occur=BooleanClause.Occur.SHOULD;
+        }
+      } else {
+        occur=BooleanClause.Occur.SHOULD;
+      }
 
       current.add(q, occur);
     }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Wed Oct 14 22:56:29 2009
@@ -318,9 +318,9 @@
       for (int i=0; i<1000; i++) {
         int lev = rnd.nextInt(maxLev);
         final long seed = rnd.nextLong();
-        BooleanQuery q1 = TestBoolean2.randBoolQuery(new Random(seed), lev, field, vals, null);
+        BooleanQuery q1 = TestBoolean2.randBoolQuery(new Random(seed), true, lev, field, vals, null);
         // BooleanQuery q2 = TestBoolean2.randBoolQuery(new Random(seed), lev, field, vals, minNrCB);
-        BooleanQuery q2 = TestBoolean2.randBoolQuery(new Random(seed), lev, field, vals, null);
+        BooleanQuery q2 = TestBoolean2.randBoolQuery(new Random(seed), true, lev, field, vals, null);
         // only set minimumNumberShouldMatch on the top level query since setting
         // at a lower level can change the score.
         minNrCB.postCreate(q2);

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/search/TestPositionIncrement.java Wed Oct 14 22:56:29 2009
@@ -233,104 +233,91 @@
   }
   
   public void testPayloadsPos0() throws Exception {
-    for(int x=0;x<2;x++) {
-      
-      Directory dir = new MockRAMDirectory();
-      IndexWriter writer = new IndexWriter(dir,
-                                           new TestPayloadAnalyzer(), true,
-                                           IndexWriter.MaxFieldLength.LIMITED);
-      if (x == 1) {
-        writer.setAllowMinus1Position();
-      }
-      Document doc = new Document();
-      doc.add(new Field("content",
-                        new StringReader("a a b c d e a f g h i j a b k k")));
-      writer.addDocument(doc);
-
-      IndexReader r = writer.getReader();
-
-      TermPositions tp = r.termPositions(new Term("content", "a"));
-      int count = 0;
-      assertTrue(tp.next());
-      // "a" occurs 4 times
-      assertEquals(4, tp.freq());
-      int expected;
-      if (x == 1) {
-        expected = Integer.MAX_VALUE;
-      } else {
-        expected = 0;
-      }
-      assertEquals(expected, tp.nextPosition());
-      if (x == 1) {
-        continue;
-      }
-      assertEquals(1, tp.nextPosition());
-      assertEquals(3, tp.nextPosition());
-      assertEquals(6, tp.nextPosition());
-
-      // only one doc has "a"
-      assertFalse(tp.next());
-
-      IndexSearcher is = new IndexSearcher(r);
-    
-      SpanTermQuery stq1 = new SpanTermQuery(new Term("content", "a"));
-      SpanTermQuery stq2 = new SpanTermQuery(new Term("content", "k"));
-      SpanQuery[] sqs = { stq1, stq2 };
-      SpanNearQuery snq = new SpanNearQuery(sqs, 30, false);
-
-      count = 0;
-      boolean sawZero = false;
+    Directory dir = new MockRAMDirectory();
+    IndexWriter writer = new IndexWriter(dir, new TestPayloadAnalyzer(), true,
+        IndexWriter.MaxFieldLength.LIMITED);
+    Document doc = new Document();
+    doc.add(new Field("content", new StringReader(
+        "a a b c d e a f g h i j a b k k")));
+    writer.addDocument(doc);
+
+    IndexReader r = writer.getReader();
+
+    TermPositions tp = r.termPositions(new Term("content", "a"));
+    int count = 0;
+    assertTrue(tp.next());
+    // "a" occurs 4 times
+    assertEquals(4, tp.freq());
+    int expected = 0;
+    assertEquals(expected, tp.nextPosition());
+    assertEquals(1, tp.nextPosition());
+    assertEquals(3, tp.nextPosition());
+    assertEquals(6, tp.nextPosition());
+
+    // only one doc has "a"
+    assertFalse(tp.next());
+
+    IndexSearcher is = new IndexSearcher(r);
+
+    SpanTermQuery stq1 = new SpanTermQuery(new Term("content", "a"));
+    SpanTermQuery stq2 = new SpanTermQuery(new Term("content", "k"));
+    SpanQuery[] sqs = { stq1, stq2 };
+    SpanNearQuery snq = new SpanNearQuery(sqs, 30, false);
+
+    count = 0;
+    boolean sawZero = false;
+    if (VERBOSE) {
+      System.out.println("\ngetPayloadSpans test");
+    }
+    Spans pspans = snq.getSpans(is.getIndexReader());
+    while (pspans.next()) {
       if (VERBOSE) {
-        System.out.println("\ngetPayloadSpans test");
+        System.out.println("doc " + pspans.doc() + ": span " + pspans.start()
+            + " to " + pspans.end());
       }
-      Spans pspans = snq.getSpans(is.getIndexReader());
-      while (pspans.next()) {
-        if (VERBOSE) {
-          System.out.println("doc " + pspans.doc() + ": span " + pspans.start() + " to "+ pspans.end());
-        }
-        Collection payloads = pspans.getPayload();
-        sawZero |= pspans.start() == 0;
-        for (Iterator it = payloads.iterator(); it.hasNext();) {
-          count++;
-          if (!VERBOSE) {
-            it.next();
-          } else {
-            System.out.println("  payload: " + new String((byte[]) it.next()));
-          }
+      Collection payloads = pspans.getPayload();
+      sawZero |= pspans.start() == 0;
+      for (Iterator it = payloads.iterator(); it.hasNext();) {
+        count++;
+        if (!VERBOSE) {
+          it.next();
+        } else {
+          System.out.println("  payload: " + new String((byte[]) it.next()));
         }
       }
-      assertEquals(5, count);
-      assertTrue(sawZero);
+    }
+    assertEquals(5, count);
+    assertTrue(sawZero);
 
-      //System.out.println("\ngetSpans test");
-      Spans spans = snq.getSpans(is.getIndexReader());
-      count = 0;
-      sawZero = false;
-      while (spans.next()) {
-        count++;
-        sawZero |= spans.start() == 0;
-        //System.out.println(spans.doc() + " - " + spans.start() + " - " + spans.end());
-      }
-      assertEquals(4, count);
-      assertTrue(sawZero);
-		
-      //System.out.println("\nPayloadSpanUtil test");
-
-      sawZero = false;
-      PayloadSpanUtil psu = new PayloadSpanUtil(is.getIndexReader());
-      Collection pls = psu.getPayloadsForQuery(snq);
-      count = pls.size();
-      for (Iterator it = pls.iterator(); it.hasNext();) {
-        String s = new String((byte[]) it.next());
-        //System.out.println(s);
-        sawZero |= s.equals("pos: 0");
-      }
-      assertEquals(5, count);
-      assertTrue(sawZero);
-      writer.close();
-      is.getIndexReader().close();
-      dir.close();
+    // System.out.println("\ngetSpans test");
+    Spans spans = snq.getSpans(is.getIndexReader());
+    count = 0;
+    sawZero = false;
+    while (spans.next()) {
+      count++;
+      sawZero |= spans.start() == 0;
+      // System.out.println(spans.doc() + " - " + spans.start() + " - " +
+      // spans.end());
+    }
+    assertEquals(4, count);
+    assertTrue(sawZero);
+
+    // System.out.println("\nPayloadSpanUtil test");
+
+    sawZero = false;
+    PayloadSpanUtil psu = new PayloadSpanUtil(is.getIndexReader());
+    Collection pls = psu.getPayloadsForQuery(snq);
+    count = pls.size();
+    for (Iterator it = pls.iterator(); it.hasNext();) {
+      String s = new String((byte[]) it.next());
+      // System.out.println(s);
+      sawZero |= s.equals("pos: 0");
     }
+    assertEquals(5, count);
+    assertTrue(sawZero);
+    writer.close();
+    is.getIndexReader().close();
+    dir.close();
   }
 }
 

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java?rev=825328&r1=825327&r2=825328&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/store/TestRAMDirectory.java Wed Oct 14 22:56:29 2009
@@ -62,7 +62,7 @@
       doc.add(new Field("content", English.intToEnglish(i).trim(), Field.Store.YES, Field.Index.NOT_ANALYZED));
       writer.addDocument(doc);
     }
-    assertEquals(docsToAdd, writer.docCount());
+    assertEquals(docsToAdd, writer.maxDoc());
     writer.close();
     dir.close();
   }



Mime
View raw message