lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1340108 - in /lucene/dev/branches/lucene4055/lucene/core/src: java/org/apache/lucene/codecs/sep/ java/org/apache/lucene/index/ test/org/apache/lucene/index/
Date Fri, 18 May 2012 14:31:35 GMT
Author: rmuir
Date: Fri May 18 14:31:35 2012
New Revision: 1340108

URL: http://svn.apache.org/viewvc?rev=1340108&view=rev
Log:
LUCENE-4055: nuke more mutability

Modified:
    lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/codecs/sep/SepDocValuesConsumer.java
    lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
    lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/PerDocWriteState.java
    lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
    lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestFieldInfos.java

Modified: lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/codecs/sep/SepDocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/codecs/sep/SepDocValuesConsumer.java?rev=1340108&r1=1340107&r2=1340108&view=diff
==============================================================================
--- lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/codecs/sep/SepDocValuesConsumer.java
(original)
+++ lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/codecs/sep/SepDocValuesConsumer.java
Fri May 18 14:31:35 2012
@@ -38,12 +38,10 @@ import org.apache.lucene.util.IOUtils;
 
 public class SepDocValuesConsumer extends DocValuesWriterBase {
   private final Directory directory;
-  private final FieldInfos fieldInfos;
 
   public SepDocValuesConsumer(PerDocWriteState state) throws IOException {
     super(state);
     this.directory = state.directory;
-    fieldInfos = state.fieldInfos;
   }
   
   @Override

Modified: lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java?rev=1340108&r1=1340107&r2=1340108&view=diff
==============================================================================
--- lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
(original)
+++ lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java
Fri May 18 14:31:35 2012
@@ -560,7 +560,7 @@ class DocumentsWriterPerThread {
 
   PerDocWriteState newPerDocWriteState(String segmentSuffix) {
     assert segment != null;
-    return new PerDocWriteState(infoStream, directory, segment, fieldInfos, bytesUsed, segmentSuffix,
IOContext.DEFAULT);
+    return new PerDocWriteState(infoStream, directory, segment, bytesUsed, segmentSuffix,
IOContext.DEFAULT);
   }
   
   @Override

Modified: lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/PerDocWriteState.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/PerDocWriteState.java?rev=1340108&r1=1340107&r2=1340108&view=diff
==============================================================================
--- lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/PerDocWriteState.java
(original)
+++ lucene/dev/branches/lucene4055/lucene/core/src/java/org/apache/lucene/index/PerDocWriteState.java
Fri May 18 14:31:35 2012
@@ -33,18 +33,16 @@ public class PerDocWriteState {
   public final InfoStream infoStream;
   public final Directory directory;
   public final String segmentName;
-  public final FieldInfos fieldInfos;
   public final Counter bytesUsed;
   public final String segmentSuffix;
   public final IOContext context;
 
   public PerDocWriteState(InfoStream infoStream, Directory directory,
-      String segmentName, FieldInfos fieldInfos, Counter bytesUsed,
+      String segmentName, Counter bytesUsed,
       String segmentSuffix, IOContext context) {
     this.infoStream = infoStream;
     this.directory = directory;
     this.segmentName = segmentName;
-    this.fieldInfos = fieldInfos;
     this.segmentSuffix = segmentSuffix;
     this.bytesUsed = bytesUsed;
     this.context = context;
@@ -54,7 +52,6 @@ public class PerDocWriteState {
     infoStream = state.infoStream;
     directory = state.directory;
     segmentName = state.segmentName;
-    fieldInfos = state.fieldInfos;
     segmentSuffix = state.segmentSuffix;
     bytesUsed = Counter.newCounter();
     context = state.context;
@@ -64,7 +61,6 @@ public class PerDocWriteState {
     this.infoStream = state.infoStream;
     this.directory = state.directory;
     this.segmentName = state.segmentName;
-    this.fieldInfos = state.fieldInfos;
     this.segmentSuffix = segmentSuffix;
     this.bytesUsed = state.bytesUsed;
     this.context = state.context;

Modified: lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java?rev=1340108&r1=1340107&r2=1340108&view=diff
==============================================================================
--- lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
(original)
+++ lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
Fri May 18 14:31:35 2012
@@ -248,11 +248,11 @@ public class TestCodecs extends LuceneTe
       terms[i] = new TermData(text, docs, null);
     }
 
-    final MutableFieldInfos fieldInfos = new MutableFieldInfos(new MutableFieldInfos.FieldNumberBiMap());
+    final MutableFieldInfos builder = new MutableFieldInfos(new MutableFieldInfos.FieldNumberBiMap());
 
-    final FieldData field = new FieldData("field", fieldInfos, terms, true, false);
+    final FieldData field = new FieldData("field", builder, terms, true, false);
     final FieldData[] fields = new FieldData[] {field};
-
+    final FieldInfos fieldInfos = builder.finish();
     final Directory dir = newDirectory();
     this.write(fieldInfos, dir, fields, true);
     Codec codec = Codec.getDefault();
@@ -294,16 +294,17 @@ public class TestCodecs extends LuceneTe
   }
 
   public void testRandomPostings() throws Throwable {
-    final MutableFieldInfos fieldInfos = new MutableFieldInfos(new MutableFieldInfos.FieldNumberBiMap());
+    final MutableFieldInfos builder = new MutableFieldInfos(new MutableFieldInfos.FieldNumberBiMap());
 
     final FieldData[] fields = new FieldData[NUM_FIELDS];
     for(int i=0;i<NUM_FIELDS;i++) {
       final boolean omitTF = 0==(i%3);
       final boolean storePayloads = 1==(i%3);
-      fields[i] = new FieldData(fieldNames[i], fieldInfos, this.makeRandomTerms(omitTF, storePayloads),
omitTF, storePayloads);
+      fields[i] = new FieldData(fieldNames[i], builder, this.makeRandomTerms(omitTF, storePayloads),
omitTF, storePayloads);
     }
 
     final Directory dir = newDirectory();
+    final FieldInfos fieldInfos = builder.finish();
 
     if (VERBOSE) {
       System.out.println("TEST: now write postings");

Modified: lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestFieldInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestFieldInfos.java?rev=1340108&r1=1340107&r2=1340108&view=diff
==============================================================================
--- lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestFieldInfos.java
(original)
+++ lucene/dev/branches/lucene4055/lucene/core/src/test/org/apache/lucene/index/TestFieldInfos.java
Fri May 18 14:31:35 2012
@@ -46,10 +46,11 @@ public class TestFieldInfos extends Luce
   public FieldInfos createAndWriteFieldInfos(Directory dir, String filename) throws IOException{
   //Positive test of FieldInfos
     assertTrue(testDoc != null);
-    MutableFieldInfos fieldInfos = new MutableFieldInfos(new MutableFieldInfos.FieldNumberBiMap());
+    MutableFieldInfos builder = new MutableFieldInfos(new MutableFieldInfos.FieldNumberBiMap());
     for (IndexableField field : testDoc) {
-      fieldInfos.addOrUpdate(field.name(), field.fieldType());
+      builder.addOrUpdate(field.name(), field.fieldType());
     }
+    FieldInfos fieldInfos = builder.finish();
     //Since the complement is stored as well in the fields map
     assertTrue(fieldInfos.size() == DocHelper.all.size()); //this is all b/c we are using
the no-arg constructor
     



Mime
View raw message