lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r915849 - in /lucene/java/branches/flex_1458_3_0_back_compat_tests/src: java/org/apache/lucene/index/ java/org/apache/lucene/index/codecs/ test/org/apache/lucene/index/
Date Wed, 24 Feb 2010 16:18:46 GMT
Author: mikemccand
Date: Wed Feb 24 16:18:45 2010
New Revision: 915849

URL: http://svn.apache.org/viewvc?rev=915849&view=rev
Log:
LUCENE-2111 (flex, bw branch): remove some more nocommits; enable forkmode=batch; change BytesRef.toString
-> utf8ToString

Added:
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/Codec.java
  (with props)
Modified:
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentInfo.java
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentMerger.java
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestDoc.java
    lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentMerger.java

Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentInfo.java?rev=915849&r1=915848&r2=915849&view=diff
==============================================================================
--- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentInfo.java
(original)
+++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentInfo.java
Wed Feb 24 16:18:45 2010
@@ -21,6 +21,7 @@
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.util.BitVector;
+import org.apache.lucene.index.codecs.Codec;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -129,6 +130,12 @@
     assert docStoreOffset == -1 || docStoreSegment != null: "dso=" + docStoreOffset + " dss="
+ docStoreSegment + " docCount=" + docCount;
   }
 
+  // stub
+  public SegmentInfo(String name, int docCount, Directory dir, boolean isCompoundFile, boolean
hasSingleNormFile, 
+                     int docStoreOffset, String docStoreSegment, boolean docStoreIsCompoundFile,
boolean hasProx,
+                     Codec codec) {
+  }
+
   /**
    * Copy everything from src SegmentInfo into our instance.
    */

Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentMerger.java?rev=915849&r1=915848&r2=915849&view=diff
==============================================================================
--- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentMerger.java
(original)
+++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentMerger.java
Wed Feb 24 16:18:45 2010
@@ -29,6 +29,8 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.index.codecs.Codec;
+import org.apache.lucene.index.codecs.Codecs;
 
 /**
  * The SegmentMerger class combines two or more Segments, represented by an IndexReader ({@link
#add},
@@ -98,7 +100,12 @@
     }
     termIndexInterval = writer.getTermIndexInterval();
   }
-  
+
+  // stub
+  SegmentMerger(Directory dir, int termIndexInterval, String name, MergePolicy.OneMerge merge,
Codecs codecs) {  
+    checkAbort = null;
+  }
+
   boolean hasProx() {
     return fieldInfos.hasProx();
   }
@@ -171,6 +178,11 @@
     }
   }
 
+  // stub
+  final List<String> createCompoundFile(String fileName, SegmentInfo info) {
+    return null;
+  }
+
   final List<String> createCompoundFile(String fileName)
           throws IOException {
     CompoundFileWriter cfsWriter =
@@ -553,6 +565,11 @@
     }
   }
 
+  // stub
+  Codec getCodec() {
+    return null;
+  }
+
   private SegmentMergeQueue queue = null;
 
   private final void mergeTerms() throws CorruptIndexException, IOException {

Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java?rev=915849&r1=915848&r2=915849&view=diff
==============================================================================
--- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
(original)
+++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
Wed Feb 24 16:18:45 2010
@@ -37,6 +37,7 @@
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.util.BitVector;
 import org.apache.lucene.util.CloseableThreadLocal;
+import org.apache.lucene.index.codecs.Codecs;
 
 /** @version $Id */
 /**
@@ -594,6 +595,17 @@
     return instance;
   }
 
+  // stub
+  public static SegmentReader get(boolean readOnly,
+                                  Directory dir,
+                                  SegmentInfo si,
+                                  int readBufferSize,
+                                  boolean doOpenStores,
+                                  int termInfosIndexDivisor,
+                                  Codecs codecs) {
+    return null;
+  }
+
   void openDocStores() throws IOException {
     core.openDocStores(si);
   }

Added: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/Codec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/Codec.java?rev=915849&view=auto
==============================================================================
--- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/Codec.java
(added)
+++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/Codec.java
Wed Feb 24 16:18:45 2010
@@ -0,0 +1,23 @@
+package org.apache.lucene.index.codecs;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// stub
+public class Codec {
+
+}

Propchange: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/index/codecs/Codec.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestDoc.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestDoc.java?rev=915849&r1=915848&r2=915849&view=diff
==============================================================================
--- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestDoc.java
(original)
+++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestDoc.java
Wed Feb 24 16:18:45 2010
@@ -35,6 +35,7 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.index.codecs.Codecs;
 
 
 /** JUnit adaptation of an older test case DocTest. */
@@ -180,20 +181,24 @@
       SegmentReader r1 = SegmentReader.get(true, si1, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
       SegmentReader r2 = SegmentReader.get(true, si2, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
 
-      SegmentMerger merger = new SegmentMerger(si1.dir, merged);
+      SegmentMerger merger = new SegmentMerger(si1.dir, IndexWriter.DEFAULT_TERM_INDEX_INTERVAL,
merged, null, Codecs.getDefault());
 
       merger.add(r1);
       merger.add(r2);
       merger.merge();
       merger.closeReaders();
       
+      final SegmentInfo info = new SegmentInfo(merged, si1.docCount + si2.docCount, si1.dir,
+                                               useCompoundFile, true, -1, null, false, merger.hasProx(),
+                                               merger.getCodec());
+      
       if (useCompoundFile) {
-        List filesToDelete = merger.createCompoundFile(merged + ".cfs");
+        List filesToDelete = merger.createCompoundFile(merged + ".cfs", info);
         for (Iterator iter = filesToDelete.iterator(); iter.hasNext();)
           si1.dir.deleteFile((String) iter.next());
       }
 
-      return new SegmentInfo(merged, si1.docCount + si2.docCount, si1.dir, useCompoundFile,
true);
+      return info;
    }
 
 

Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentMerger.java?rev=915849&r1=915848&r2=915849&view=diff
==============================================================================
--- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentMerger.java
(original)
+++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentMerger.java
Wed Feb 24 16:18:45 2010
@@ -18,9 +18,11 @@
  */
 
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.store.BufferedIndexInput;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.codecs.Codecs;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -63,14 +65,16 @@
   }
   
   public void testMerge() throws IOException {                             
-    SegmentMerger merger = new SegmentMerger(mergedDir, mergedSegment);
+    SegmentMerger merger = new SegmentMerger(mergedDir, IndexWriter.DEFAULT_TERM_INDEX_INTERVAL,
mergedSegment, null, Codecs.getDefault());
     merger.add(reader1);
     merger.add(reader2);
     int docsMerged = merger.merge();
     merger.closeReaders();
     assertTrue(docsMerged == 2);
     //Should be able to open a new SegmentReader against the new directory
-    SegmentReader mergedReader = SegmentReader.get(true, new SegmentInfo(mergedSegment, docsMerged,
mergedDir, false, true), IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
+    SegmentReader mergedReader = SegmentReader.get(false, mergedDir, new SegmentInfo(mergedSegment,
docsMerged, mergedDir, false, true,
+        -1, null, false, merger.hasProx(), merger.getCodec()), BufferedIndexInput.BUFFER_SIZE,
true, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR, null);
+
     assertTrue(mergedReader != null);
     assertTrue(mergedReader.numDocs() == 2);
     Document newDoc1 = mergedReader.document(0);



Mime
View raw message