lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1189955 - in /lucene/dev/branches/lucene2621/lucene: contrib/misc/src/java/org/apache/lucene/index/codecs/appending/ src/test/org/apache/lucene/ src/test/org/apache/lucene/index/ src/test/org/apache/lucene/index/codecs/pulsing/
Date Thu, 27 Oct 2011 19:28:09 GMT
Author: rmuir
Date: Thu Oct 27 19:28:08 2011
New Revision: 1189955

URL: http://svn.apache.org/viewvc?rev=1189955&view=rev
Log:
LUCENE-3490: fix up a few more tests

Modified:
    lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
    lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/TestExternalCodecs.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestCodecs.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDoc.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDocTermOrds.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/codecs/pulsing/TestPulsingReuse.java

Modified: lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
Thu Oct 27 19:28:08 2011
@@ -18,7 +18,9 @@ package org.apache.lucene.index.codecs.a
  */
 
 import org.apache.lucene.index.codecs.Codec;
+import org.apache.lucene.index.codecs.DefaultDocValuesFormat;
 import org.apache.lucene.index.codecs.DefaultFieldsFormat;
+import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldsFormat;
 import org.apache.lucene.index.codecs.PostingsFormat;
 import org.apache.lucene.index.codecs.lucene40.Lucene40PostingsFormat;
@@ -41,6 +43,7 @@ public class AppendingCodec extends Code
 
   private final PostingsFormat postings = new AppendingPostingsFormat();
   private final FieldsFormat fields = new DefaultFieldsFormat();
+  private final DocValuesFormat docValues = new DefaultDocValuesFormat();
 
   @Override
   public PostingsFormat postingsFormat() {
@@ -51,4 +54,9 @@ public class AppendingCodec extends Code
   public FieldsFormat fieldsFormat() {
     return fields;
   }
+
+  @Override
+  public DocValuesFormat docValuesFormat() {
+    return docValues;
+  }
 }

Modified: lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingPostingsFormat.java
Thu Oct 27 19:28:08 2011
@@ -129,22 +129,10 @@ class AppendingPostingsFormat extends Po
     Lucene40PostingsReader.files(dir, segmentInfo, formatId, files);
     BlockTermsReader.files(dir, segmentInfo, formatId, files);
     FixedGapTermsIndexReader.files(dir, segmentInfo, formatId, files);
-    DefaultDocValuesConsumer.files(dir, segmentInfo, formatId, files);
   }
 
   @Override
   public void getExtensions(Set<String> extensions) {
     Lucene40PostingsFormat.getStandardExtensions(extensions);
-    DefaultDocValuesConsumer.getExtensions(extensions);
-  }
-  
-  @Override
-  public PerDocConsumer docsConsumer(PerDocWriteState state) throws IOException {
-    return new DefaultDocValuesConsumer(state);
-  }
-
-  @Override
-  public PerDocValues docsProducer(SegmentReadState state) throws IOException {
-    return new DefaultDocValuesProducer(state);
   }
 }

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/TestExternalCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/TestExternalCodecs.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/TestExternalCodecs.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/TestExternalCodecs.java
Thu Oct 27 19:28:08 2011
@@ -498,16 +498,6 @@ public class TestExternalCodecs extends 
     }
 
     @Override
-    public PerDocConsumer docsConsumer(PerDocWriteState state) throws IOException {
-      return null;
-    }
-
-    @Override
-    public PerDocValues docsProducer(SegmentReadState state) throws IOException {
-      return null;
-    }
-
-    @Override
     public void getExtensions(Set<String> extensions) {
     }
 

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestCodecs.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestCodecs.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestCodecs.java
Thu Oct 27 19:28:08 2011
@@ -26,15 +26,16 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.index.codecs.FieldsConsumer;
 import org.apache.lucene.index.codecs.FieldsProducer;
 import org.apache.lucene.index.codecs.PostingsConsumer;
 import org.apache.lucene.index.codecs.TermStats;
 import org.apache.lucene.index.codecs.TermsConsumer;
+import org.apache.lucene.index.codecs.lucene3x.Lucene3xCodec;
 import org.apache.lucene.index.codecs.lucene3x.Lucene3xPostingsFormat;
 import org.apache.lucene.index.codecs.mocksep.MockSepPostingsFormat;
-import org.apache.lucene.index.codecs.perfield.SegmentFormats;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.PhraseQuery;
@@ -256,9 +257,10 @@ public class TestCodecs extends LuceneTe
     final Directory dir = newDirectory();
     FieldInfos clonedFieldInfos = (FieldInfos) fieldInfos.clone();
     this.write(fieldInfos, dir, fields, true);
-    final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, clonedFieldInfos.buildSegmentCodecs(false),
clonedFieldInfos);
+    Codec codec = CodecProvider.getDefault().getDefaultCodec();
+    final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos);
 
-    final FieldsProducer reader = si.getSegmentCodecs().codec().fieldsProducer(new SegmentReadState(dir,
si, fieldInfos, newIOContext(random), IndexReader.DEFAULT_TERMS_INDEX_DIVISOR));
+    final FieldsProducer reader = codec.postingsFormat().fieldsProducer(new SegmentReadState(dir,
si, fieldInfos, newIOContext(random), IndexReader.DEFAULT_TERMS_INDEX_DIVISOR));
 
     final FieldsEnum fieldsEnum = reader.iterator();
     assertNotNull(fieldsEnum.next());
@@ -308,12 +310,13 @@ public class TestCodecs extends LuceneTe
 
     FieldInfos clonedFieldInfos = (FieldInfos) fieldInfos.clone();
     this.write(fieldInfos, dir, fields, false);
-    final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, clonedFieldInfos.buildSegmentCodecs(false),
clonedFieldInfos);
+    Codec codec = CodecProvider.getDefault().getDefaultCodec();
+    final SegmentInfo si = new SegmentInfo(SEGMENT, 10000, dir, false, codec, clonedFieldInfos);
 
     if (VERBOSE) {
       System.out.println("TEST: now read postings");
     }
-    final FieldsProducer terms = si.getSegmentCodecs().codec().fieldsProducer(new SegmentReadState(dir,
si, fieldInfos, newIOContext(random), IndexReader.DEFAULT_TERMS_INDEX_DIVISOR));
+    final FieldsProducer terms = codec.postingsFormat().fieldsProducer(new SegmentReadState(dir,
si, fieldInfos, newIOContext(random), IndexReader.DEFAULT_TERMS_INDEX_DIVISOR));
 
     final Verify[] threads = new Verify[NUM_TEST_THREADS-1];
     for(int i=0;i<NUM_TEST_THREADS-1;i++) {
@@ -459,8 +462,7 @@ public class TestCodecs extends LuceneTe
       for(int iter=0;iter<NUM_TEST_ITER;iter++) {
         final FieldData field = fields[TestCodecs.random.nextInt(fields.length)];
         final TermsEnum termsEnum = termsDict.terms(field.fieldInfo.name).iterator();
-        assertTrue(field.fieldInfo.getCodecId() != FieldInfo.UNASSIGNED_CODEC_ID);
-        if (si.getSegmentCodecs().codecs[field.fieldInfo.getCodecId()] instanceof Lucene3xPostingsFormat)
{
+        if (si.getCodec() instanceof Lucene3xCodec) {
           // code below expects unicode sort order
           continue;
         }
@@ -615,14 +617,13 @@ public class TestCodecs extends LuceneTe
   private void write(final FieldInfos fieldInfos, final Directory dir, final FieldData[]
fields, boolean allowPreFlex) throws Throwable {
 
     final int termIndexInterval = _TestUtil.nextInt(random, 13, 27);
-    final SegmentFormats codecInfo =  fieldInfos.buildSegmentCodecs(false);
-    final SegmentWriteState state = new SegmentWriteState(null, dir, SEGMENT, fieldInfos,
10000, termIndexInterval, codecInfo, null, newIOContext(random));
+    final Codec codec = CodecProvider.getDefault().getDefaultCodec();
+    final SegmentWriteState state = new SegmentWriteState(null, dir, SEGMENT, fieldInfos,
10000, termIndexInterval, codec, null, newIOContext(random));
 
-    final FieldsConsumer consumer = state.segmentCodecs.codec().fieldsConsumer(state);
+    final FieldsConsumer consumer = codec.postingsFormat().fieldsConsumer(state);
     Arrays.sort(fields);
     for (final FieldData field : fields) {
-      assertTrue(field.fieldInfo.getCodecId() != FieldInfo.UNASSIGNED_CODEC_ID);
-      if (!allowPreFlex && codecInfo.codecs[field.fieldInfo.getCodecId()] instanceof
Lucene3xPostingsFormat) {
+      if (!allowPreFlex && codec instanceof Lucene3xCodec) {
         // code below expects unicode sort order
         continue;
       }

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDoc.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDoc.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDoc.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDoc.java Thu
Oct 27 19:28:08 2011
@@ -33,6 +33,7 @@ import org.apache.lucene.analysis.MockAn
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.TextField;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.search.DocIdSetIterator;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
@@ -197,7 +198,7 @@ public class TestDoc extends LuceneTestC
       SegmentReader r1 = SegmentReader.get(true, si1, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR,
context);
       SegmentReader r2 = SegmentReader.get(true, si2, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR,
context);
 
-      SegmentMerger merger = new SegmentMerger(si1.dir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL,
merged, null, null, new FieldInfos(), context);
+      SegmentMerger merger = new SegmentMerger(si1.dir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL,
merged, null, null, new FieldInfos(), CodecProvider.getDefault(), context);
 
       merger.add(r1);
       merger.add(r2);
@@ -206,7 +207,7 @@ public class TestDoc extends LuceneTestC
       r2.close();
       final FieldInfos fieldInfos =  merger.fieldInfos();
       final SegmentInfo info = new SegmentInfo(merged, si1.docCount + si2.docCount, si1.dir,
-                                               false, merger.getSegmentFormats(), fieldInfos);
+                                               false, merger.getCodec(), fieldInfos);
       
       if (useCompoundFile) {
         Collection<String> filesToDelete = merger.createCompoundFile(merged + ".cfs",
info, newIOContext(random));

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDocTermOrds.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDocTermOrds.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDocTermOrds.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestDocTermOrds.java
Thu Oct 27 19:28:08 2011
@@ -34,18 +34,16 @@ import org.apache.lucene.index.DocTermOr
 import org.apache.lucene.index.codecs.BlockTermsReader;
 import org.apache.lucene.index.codecs.BlockTermsWriter;
 import org.apache.lucene.index.codecs.Codec;
+import org.apache.lucene.index.codecs.DefaultDocValuesFormat;
 import org.apache.lucene.index.codecs.DefaultFieldsFormat;
+import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldsFormat;
 import org.apache.lucene.index.codecs.PostingsFormat;
 import org.apache.lucene.index.codecs.CoreCodecProvider;
-import org.apache.lucene.index.codecs.DefaultDocValuesProducer;
 import org.apache.lucene.index.codecs.FieldsConsumer;
 import org.apache.lucene.index.codecs.FieldsProducer;
 import org.apache.lucene.index.codecs.FixedGapTermsIndexReader;
 import org.apache.lucene.index.codecs.FixedGapTermsIndexWriter;
-import org.apache.lucene.index.codecs.PerDocConsumer;
-import org.apache.lucene.index.codecs.DefaultDocValuesConsumer;
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.index.codecs.PostingsReaderBase;
 import org.apache.lucene.index.codecs.PostingsWriterBase;
 import org.apache.lucene.index.codecs.TermsIndexReaderBase;
@@ -112,6 +110,7 @@ public class TestDocTermOrds extends Luc
   private static class StandardCodecWithOrds extends Codec {
     private final PostingsFormat postings = new StandardPostingsFormatWithOrds();
     private final FieldsFormat fields = new DefaultFieldsFormat();
+    private final DocValuesFormat docValues = new DefaultDocValuesFormat();
 
     public StandardCodecWithOrds() {
       super("StandardOrds");
@@ -125,7 +124,12 @@ public class TestDocTermOrds extends Luc
     @Override
     public FieldsFormat fieldsFormat() {
       return fields;
-    }  
+    }
+
+    @Override
+    public DocValuesFormat docValuesFormat() {
+      return docValues;
+    }
   }
 
   private static class StandardPostingsFormatWithOrds extends PostingsFormat {
@@ -225,13 +229,11 @@ public class TestDocTermOrds extends Luc
       Lucene40PostingsReader.files(dir, segmentInfo, id, files);
       BlockTermsReader.files(dir, segmentInfo, id, files);
       FixedGapTermsIndexReader.files(dir, segmentInfo, id, files);
-      DefaultDocValuesConsumer.files(dir, segmentInfo, id, files);
     }
 
     @Override
     public void getExtensions(Set<String> extensions) {
       getStandardExtensions(extensions);
-      DefaultDocValuesConsumer.getExtensions(extensions);
     }
 
     public static void getStandardExtensions(Set<String> extensions) {
@@ -240,16 +242,6 @@ public class TestDocTermOrds extends Luc
       BlockTermsReader.getExtensions(extensions);
       FixedGapTermsIndexReader.getIndexExtensions(extensions);
     }
-    
-    @Override
-    public PerDocConsumer docsConsumer(PerDocWriteState state) throws IOException {
-      return new DefaultDocValuesConsumer(state);
-    }
-
-    @Override
-    public PerDocValues docsProducer(SegmentReadState state) throws IOException {
-      return new DefaultDocValuesProducer(state);
-    }
   }
 
   public void testRandom() throws Exception {

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestSegmentMerger.java
Thu Oct 27 19:28:08 2011
@@ -23,6 +23,7 @@ import org.apache.lucene.analysis.MockAn
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.TextField;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.util.BytesRef;
 
 import java.io.IOException;
@@ -74,7 +75,7 @@ public class TestSegmentMerger extends L
   }
 
   public void testMerge() throws IOException {
-    SegmentMerger merger = new SegmentMerger(mergedDir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL,
mergedSegment, null, null, new FieldInfos(), newIOContext(random));
+    SegmentMerger merger = new SegmentMerger(mergedDir, IndexWriterConfig.DEFAULT_TERM_INDEX_INTERVAL,
mergedSegment, null, null, new FieldInfos(), CodecProvider.getDefault(), newIOContext(random));
     merger.add(reader1);
     merger.add(reader2);
     int docsMerged = merger.merge();
@@ -82,7 +83,7 @@ public class TestSegmentMerger extends L
     final FieldInfos fieldInfos = merger.fieldInfos();
     //Should be able to open a new SegmentReader against the new directory
     SegmentReader mergedReader = SegmentReader.get(false, mergedDir, new SegmentInfo(mergedSegment,
docsMerged, mergedDir, false,
-                                                                                     merger.getSegmentFormats(),
fieldInfos),
+                                                                                     merger.getCodec(),
fieldInfos),
                                                    true, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR,
newIOContext(random));
     assertTrue(mergedReader != null);
     assertTrue(mergedReader.numDocs() == 2);
@@ -145,7 +146,7 @@ public class TestSegmentMerger extends L
     w.close();
     
     // Assert that SM fails if .del exists
-    SegmentMerger sm = new SegmentMerger(dir, 1, "a", null, null, null, newIOContext(random));
+    SegmentMerger sm = new SegmentMerger(dir, 1, "a", null, null, null, CodecProvider.getDefault(),
newIOContext(random));
     try {
       sm.createCompoundFile("b1", w.segmentInfos.info(0), newIOContext(random));
       fail("should not have been able to create a .cfs with .del and .s* files");

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/codecs/pulsing/TestPulsingReuse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/codecs/pulsing/TestPulsingReuse.java?rev=1189955&r1=1189954&r2=1189955&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/codecs/pulsing/TestPulsingReuse.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/codecs/pulsing/TestPulsingReuse.java
Thu Oct 27 19:28:08 2011
@@ -191,26 +191,14 @@ public class TestPulsingReuse extends Lu
     }
 
     @Override
-    public PerDocConsumer docsConsumer(PerDocWriteState state) throws IOException {
-      return new DefaultDocValuesConsumer(state);
-    }
-
-    @Override
-    public PerDocValues docsProducer(SegmentReadState state) throws IOException {
-      return new DefaultDocValuesProducer(state);
-    }
-
-    @Override
     public void files(Directory dir, SegmentInfo segmentInfo, int id, Set<String> files)
throws IOException {
       Lucene40PostingsReader.files(dir, segmentInfo, id, files);
       BlockTreeTermsReader.files(dir, segmentInfo, id, files);
-      DefaultDocValuesConsumer.files(dir, segmentInfo, id, files);
     }
 
     @Override
     public void getExtensions(Set<String> extensions) {
       Lucene40PostingsFormat.getStandardExtensions(extensions);
-      DefaultDocValuesConsumer.getExtensions(extensions);
     }
   }
 }



Mime
View raw message