Revision: 18409
          http://sourceforge.net/p/gate/code/18409
Author:   ian_roberts
Date:     2014-10-27 17:38:21 +0000 (Mon, 27 Oct 2014)
Log Message:
-----------
For a documental cluster of N indexes there need to be N+1 cutpoints, 
*in*cluding one for the end of the last batch.

Modified Paths:
--------------
    mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java

Modified: mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java        
2014-10-27 02:20:09 UTC (rev 18408)
+++ mimir/trunk/mimir-core/src/gate/mimir/index/AtomicIndex.java        
2014-10-27 17:38:21 UTC (rev 18409)
@@ -454,7 +454,10 @@
     
     // prepare the documental cluster
     Index[] indexes = new Index[batches.size()];
-    long[] cutPoints = new long[indexes.length];
+    // cut points between the batches - there are numBatches+1 cutpoints,
+    // cutPoints[0] is always zero, and cutPoints[i] is the sum of the
+    // sizes of batches 0 to i-1 inclusive
+    long[] cutPoints = new long[indexes.length + 1];
     cutPoints[0] = 0;
     int numberOfTerms = -1;
     int numberOfDocuments = -1;
@@ -468,10 +471,8 @@
     
     for(MG4JIndex aSubIndex : batches) {
       indexes[indexIdx] = aSubIndex.invertedIndex;
-      if(indexIdx < cutPoints.length - 1) {
-        cutPoints[indexIdx + 1] = cutPoints[indexIdx] + 
-            aSubIndex.invertedIndex.numberOfDocuments;
-      }
+      cutPoints[indexIdx + 1] = cutPoints[indexIdx] + 
+          aSubIndex.invertedIndex.numberOfDocuments;
       numberOfTerms += aSubIndex.invertedIndex.numberOfTerms;
       numberOfDocuments += aSubIndex.invertedIndex.numberOfDocuments;
       numberOfPostings += aSubIndex.invertedIndex.numberOfPostings;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to