lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r950306 - in /lucene/java/branches/lucene_2_9: ./ contrib/ contrib/analyzers/ contrib/highlighter/src/test/ contrib/instantiated/src/test/org/apache/lucene/store/instantiated/ src/java/org/apache/lucene/analysis/ src/java/org/apache/lucene/...
Date Tue, 01 Jun 2010 23:33:35 GMT
Author: mikemccand
Date: Tue Jun  1 23:33:34 2010
New Revision: 950306

URL: http://svn.apache.org/viewvc?rev=950306&view=rev
Log:
LUCENE-2161: NRT concurrency fixes

Modified:
    lucene/java/branches/lucene_2_9/   (props changed)
    lucene/java/branches/lucene_2_9/CHANGES.txt   (contents, props changed)
    lucene/java/branches/lucene_2_9/build.xml   (props changed)
    lucene/java/branches/lucene_2_9/contrib/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/CHANGES.txt   (props changed)
    lucene/java/branches/lucene_2_9/contrib/analyzers/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/highlighter/src/test/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java   (props
changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/AttributeSource.java 
 (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/BitVector.java
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/   (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java
  (props changed)

Propchange: lucene/java/branches/lucene_2_9/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene:941394,946651,948430
 /lucene/dev/trunk/lucene:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_2_4:748824
-/lucene/java/branches/lucene_3_0:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Modified: lucene/java/branches/lucene_2_9/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/CHANGES.txt?rev=950306&r1=950305&r2=950306&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/CHANGES.txt Tue Jun  1 23:33:34 2010
@@ -82,6 +82,9 @@ API Changes
 
 Optimizations
 
+* LUCENE-2161: Improve concurrency of IndexReader, especially in the
+  context of near real-time readers.  (Mike McCandless)
+
 * LUCENE-2360: Small speedup to recycling of reused per-doc RAM in
   IndexWriter (Robert Muir, Mike McCandless)
 

Propchange: lucene/java/branches/lucene_2_9/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/CHANGES.txt:941394,946651,948430
 /lucene/dev/trunk/lucene/CHANGES.txt:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/CHANGES.txt:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/CHANGES.txt:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/CHANGES.txt:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/CHANGES.txt:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/build.xml:941394,946651,948430
 /lucene/dev/trunk/lucene/build.xml:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/build.xml:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/build.xml:821888,834035,836155,887670,889431-889432,889579,891205,891209,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/build.xml:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/build.xml:821888,834035,836155,887670,889431-889432,889579,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib:941394,946651,948430
 /lucene/dev/trunk/lucene/contrib:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/contrib:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/contrib:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/contrib:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/contrib:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt:941394,946651,948430
 /lucene/dev/trunk/lucene/contrib/CHANGES.txt:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/contrib/CHANGES.txt:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/contrib/CHANGES.txt:821888,834035,836155,887670,889431-889432,889579,891205,891209,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/contrib/CHANGES.txt:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/contrib/CHANGES.txt:821888,834035,836155,887670,889431-889432,889579,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/analyzers/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,3 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/analyzers:941394,946651
 /lucene/dev/trunk/lucene/contrib/analyzers:939611,940730
-/lucene/java/trunk/contrib/analyzers:834035,836155,887670,889579,891205
+/lucene/java/branches/lucene_3_0/contrib/analyzers:950301
+/lucene/java/trunk/contrib/analyzers:834035,836155,887670,889579,891205,891377

Propchange: lucene/java/branches/lucene_2_9/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test:941394,946651,948430
 /lucene/dev/trunk/lucene/contrib/highlighter/src/test:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/contrib/highlighter/src/test:821888,834035,836155,887670,889431-889432,889579,891205,891209,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/contrib/highlighter/src/test:821888,834035,836155,887670,889431-889432,889579,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -3,5 +3,5 @@
 /lucene/java/branches/lucene_2_4/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:748824
 /lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:817269-818599
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:818601-821336
-/lucene/java/branches/lucene_3_0/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:889463,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:821888,834035,836155,881213,881315,881466,881819,882374,882672,882807,882888,882977,883074-883075,883554,884870,886257,886911,887347,887532,887602,887670,888247,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:889463,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:821888,834035,836155,881213,881315,881466,881819,882374,882672,882807,882888,882977,883074-883075,883554,884870,886257,886911,887347,887532,887602,887670,888247,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Tokenizer.java:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:821888,834035,836155,887670,889579,891205,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Tokenizer.java:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:821888,834035,836155,887670,889579,891205,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java?rev=950306&r1=950305&r2=950306&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
(original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
Tue Jun  1 23:33:34 2010
@@ -124,7 +124,7 @@ class DirectoryReader extends IndexReade
   DirectoryReader(IndexWriter writer, SegmentInfos infos, int termInfosIndexDivisor) throws
IOException {
     this.directory = writer.getDirectory();
     this.readOnly = true;
-    this.segmentInfos = infos;
+    segmentInfos = infos;
     segmentInfosStart = (SegmentInfos) infos.clone();
     this.termInfosIndexDivisor = termInfosIndexDivisor;
     if (!readOnly) {
@@ -343,20 +343,37 @@ class DirectoryReader extends IndexReade
     return newReader;
   }
 
-  public final synchronized IndexReader reopen() throws CorruptIndexException, IOException
{
+  public final IndexReader reopen() throws CorruptIndexException, IOException {
     // Preserve current readOnly
     return doReopen(readOnly, null);
   }
 
-  public final synchronized IndexReader reopen(boolean openReadOnly) throws CorruptIndexException,
IOException {
+  public final IndexReader reopen(boolean openReadOnly) throws CorruptIndexException, IOException
{
     return doReopen(openReadOnly, null);
   }
 
-  public final synchronized IndexReader reopen(final IndexCommit commit) throws CorruptIndexException,
IOException {
+  public final IndexReader reopen(final IndexCommit commit) throws CorruptIndexException,
IOException {
     return doReopen(true, commit);
   }
 
-  private synchronized IndexReader doReopen(final boolean openReadOnly, IndexCommit commit)
throws CorruptIndexException, IOException {
+  private final IndexReader doReopenFromWriter(boolean openReadOnly, IndexCommit commit)
throws CorruptIndexException, IOException {
+    assert readOnly;
+
+    if (!openReadOnly) {
+      throw new IllegalArgumentException("a reader obtained from IndexWriter.getReader()
can only be reopened with openReadOnly=true (got false)");
+    }
+
+    if (commit != null) {
+      throw new IllegalArgumentException("a reader obtained from IndexWriter.getReader()
cannot currently accept a commit");
+    }
+
+    // TODO: right now we *always* make a new reader; in
+    // the future we could have write make some effort to
+    // detect that no changes have occurred
+    return writer.getReader();
+  }
+
+  private IndexReader doReopen(final boolean openReadOnly, IndexCommit commit) throws CorruptIndexException,
IOException {
     ensureOpen();
 
     assert commit == null || openReadOnly;
@@ -364,27 +381,13 @@ class DirectoryReader extends IndexReade
     // If we were obtained by writer.getReader(), re-ask the
     // writer to get a new reader.
     if (writer != null) {
-      assert readOnly;
-
-      if (!openReadOnly) {
-        throw new IllegalArgumentException("a reader obtained from IndexWriter.getReader()
can only be reopened with openReadOnly=true (got false)");
-      }
-
-      if (commit != null) {
-        throw new IllegalArgumentException("a reader obtained from IndexWriter.getReader()
cannot currently accept a commit");
-      }
-
-      if (!writer.isOpen(true)) {
-        throw new AlreadyClosedException("cannot reopen: the IndexWriter this reader was
obtained from is now closed");
-      }
-
-      // TODO: right now we *always* make a new reader; in
-      // the future we could have write make some effort to
-      // detect that no changes have occurred
-      IndexReader reader = writer.getReader();
-      reader.setDisableFakeNorms(getDisableFakeNorms());
-      return reader;
+      return doReopenFromWriter(openReadOnly, commit);
+    } else {
+      return doReopenNoWriter(openReadOnly, commit);
     }
+  }
+
+  private synchronized IndexReader doReopenNoWriter(final boolean openReadOnly, IndexCommit
commit) throws CorruptIndexException, IOException {
 
     if (commit == null) {
       if (hasChanges) {
@@ -482,9 +485,12 @@ class DirectoryReader extends IndexReade
     ensureOpen();
     return segmentInfos.size() == 1 && !hasDeletions();
   }
-  
-  public synchronized int numDocs() {
+
+  public int numDocs() {
     // Don't call ensureOpen() here (it could affect performance)
+
+    // NOTE: multiple threads may wind up init'ing
+    // numDocs... but that's harmless
     if (numDocs == -1) {        // check cache
       int n = 0;                // cache miss--recompute
       for (int i = 0; i < subReaders.length; i++)

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/IndexWriter.java?rev=950306&r1=950305&r2=950306&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/IndexWriter.java Tue
Jun  1 23:33:34 2010
@@ -462,6 +462,9 @@ public class IndexWriter {
    *  loading a TermInfo.  The default value is 1.  Set this
    *  to -1 to skip loading the terms index entirely. */
   public IndexReader getReader(int termInfosIndexDivisor) throws IOException {
+
+    ensureOpen();
+
     if (infoStream != null) {
       message("flush at getReader");
     }

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java?rev=950306&r1=950305&r2=950306&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java Tue
Jun  1 23:33:34 2010
@@ -218,8 +218,10 @@ public class MultiReader extends IndexRe
     return false;
   }
   
-  public synchronized int numDocs() {
+  public int numDocs() {
     // Don't call ensureOpen() here (it could affect performance)
+    // NOTE: multiple threads may wind up init'ing
+    // numDocs... but that's harmless
     if (numDocs == -1) {        // check cache
       int n = 0;                // cache miss--recompute
       for (int i = 0; i < subReaders.length; i++)

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java?rev=950306&r1=950305&r2=950306&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java Tue
Jun  1 23:33:34 2010
@@ -660,20 +660,28 @@ public class SegmentReader extends Index
     core.openDocStores(si);
   }
 
+  private boolean checkDeletedCounts() throws IOException {
+    final int recomputedCount = deletedDocs.getRecomputedCount();
+     
+    assert deletedDocs.count() == recomputedCount : "deleted count=" + deletedDocs.count()
+ " vs recomputed count=" + recomputedCount;
+
+    assert si.getDelCount() == recomputedCount : 
+    "delete count mismatch: info=" + si.getDelCount() + " vs BitVector=" + recomputedCount;
+
+    // Verify # deletes does not exceed maxDoc for this
+    // segment:
+    assert si.getDelCount() <= maxDoc() : 
+    "delete count mismatch: " + recomputedCount + ") exceeds max doc (" + maxDoc() + ") for
segment " + si.name;
+
+    return true;
+  }
+
   private void loadDeletedDocs() throws IOException {
     // NOTE: the bitvector is stored using the regular directory, not cfs
     if (hasDeletions(si)) {
       deletedDocs = new BitVector(directory(), si.getDelFileName());
       deletedDocsRef = new Ref();
-     
-      assert si.getDelCount() == deletedDocs.count() : 
-        "delete count mismatch: info=" + si.getDelCount() + " vs BitVector=" + deletedDocs.count();
-
-      // Verify # deletes does not exceed maxDoc for this
-      // segment:
-      assert si.getDelCount() <= maxDoc() : 
-        "delete count mismatch: " + deletedDocs.count() + ") exceeds max doc (" + maxDoc()
+ ") for segment " + si.name;
-
+      assert checkDeletedCounts();
     } else
       assert si.getDelCount() == 0;
   }

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/AttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/AttributeSource.java:946651
 /lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/AttributeSource.java:929738,932398,935522,940730,946599,949976,949997
 /lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/util/AttributeSource.java:748824
-/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/util/AttributeSource.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
+/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/util/AttributeSource.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
 /lucene/java/trunk/src/java/org/apache/lucene/util/AttributeSource.java:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889579,891189,891205,891363,894348,897672,908975,910034,910078,912407,919060

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/BitVector.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/BitVector.java?rev=950306&r1=950305&r2=950306&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/BitVector.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/BitVector.java Tue Jun
 1 23:33:34 2010
@@ -39,23 +39,27 @@ public final class BitVector implements 
 
   private byte[] bits;
   private int size;
-  private int count = -1;
+  private int count;
 
   /** Constructs a vector capable of holding <code>n</code> bits. */
   public BitVector(int n) {
     size = n;
     bits = new byte[(size >> 3) + 1];
+    count = 0;
   }
   
   BitVector(byte[] bits, int size) {
     this.bits = bits;
     this.size = size;
+    count = -1;
   }
   
   public Object clone() {
     byte[] copyBits = new byte[bits.length];
     System.arraycopy(bits, 0, copyBits, 0, bits.length);
-    return new BitVector(copyBits, size);
+    BitVector clone = new BitVector(copyBits, size);
+    clone.count = count;
+    return clone;
   }
   
   /** Sets the value of <code>bit</code> to one. */
@@ -123,6 +127,15 @@ public final class BitVector implements 
     return count;
   }
 
+  /** For testing */
+  public final int getRecomputedCount() {
+    int c = 0;
+    int end = bits.length;
+    for (int i = 0; i < end; i++)
+      c += BYTE_COUNTS[bits[i] & 0xFF];	  // sum bits per byte
+    return c;
+  }
+
   private static final byte[] BYTE_COUNTS = {	  // table of bits/byte
     0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
     1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,5 +1,5 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:946651
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:929738,932398,935522,940730,946599,949976,949997
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:748824
-/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
 /lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:818920,821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,887347,887532,887670,889579,891189,891205,891363,897672,908975,910034,910078,912407,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDateTools.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDateTools.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestDateTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestDateTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestNumberTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestNumberTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,3 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index:941394,946651
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index:940730
-/lucene/java/trunk/src/test/org/apache/lucene/index:834035,836155,887670,889579,891205
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index:950301
+/lucene/java/trunk/src/test/org/apache/lucene/index:834035,836155,887670,889579,891205,891377

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun  1 23:33:34 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
-/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/util/TestAttributeSource.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033
-/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060
+/lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/util/TestAttributeSource.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
+/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060



Mime
View raw message