lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1441625 - in /lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index: DocFieldProcessor.java FieldInfo.java FieldInfos.java
Date Fri, 01 Feb 2013 20:47:55 GMT
Author: mikemccand
Date: Fri Feb  1 20:47:55 2013
New Revision: 1441625

URL: http://svn.apache.org/viewvc?rev=1441625&view=rev
Log:
nocommits

Modified:
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java?rev=1441625&r1=1441624&r2=1441625&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java
Fri Feb  1 20:47:55 2013
@@ -253,10 +253,7 @@ final class DocFieldProcessor extends Do
         rehash();
       }
     } else {
-      // nocommit: dangerous: maybe FI.update()/FI ctor()/FIS.addOrUpdate need only take
FT
-      // instead of a thousand parameters? Surely we can make this better... like:
-      // fp.fieldInfo.update(ft);
-      fp.fieldInfo.update(ft.indexed(), false, ft.omitNorms(), false, ft.indexOptions());
+      fp.fieldInfo.update(ft);
     }
 
     if (thisFieldGen != fp.lastGen) {

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java?rev=1441625&r1=1441624&r2=1441625&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
Fri Feb  1 20:47:55 2013
@@ -20,6 +20,8 @@ package org.apache.lucene.index;
 import java.util.HashMap;
 import java.util.Map;
 
+// nocommit fails if you repeat: TestDocValuesWithThreads.test2 -seed A765AB92D216E371
+
 /**
  *  Access to the Field Info file that describes document fields and whether or
  *  not they are indexed. Each segment has a separate Field Info file. Objects
@@ -151,6 +153,10 @@ public final class FieldInfo {
     return true;
   }
 
+  void update(IndexableFieldType ft) {
+    update(ft.indexed(), false, ft.omitNorms(), false, ft.indexOptions());
+  }
+
   // should only be called by FieldInfos#addOrUpdate
   void update(boolean indexed, boolean storeTermVector, boolean omitNorms, boolean storePayloads,
IndexOptions indexOptions) {
     //System.out.println("FI.update field=" + name + " indexed=" + indexed + " omitNorms="
+ omitNorms + " this.omitNorms=" + this.omitNorms);

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java?rev=1441625&r1=1441624&r2=1441625&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
Fri Feb  1 20:47:55 2013
@@ -214,6 +214,7 @@ public class FieldInfos implements Itera
      */
     // nocommit: why is docvalues involved with global field numbers?
     // nocommit: and is it even tested...
+    /*
     synchronized void setIfNotSet(int fieldNumber, String fieldName, DocValuesType dvType)
{
       final Integer boxedFieldNumber = Integer.valueOf(fieldNumber);
       if (!numberToName.containsKey(boxedFieldNumber)
@@ -227,6 +228,7 @@ public class FieldInfos implements Itera
         assert containsConsistent(boxedFieldNumber, fieldName, dvType);
       }
     }
+    */
     
     // used by assert
     synchronized boolean containsConsistent(Integer number, String name, DocValuesType dvType)
{
@@ -264,17 +266,6 @@ public class FieldInfos implements Itera
       }
     }
    
-    /**
-     * adds the given field to this FieldInfos name / number mapping. The given FI
-     * must be present in the global field number mapping before this method it
-     * called
-     */
-    private void putInternal(FieldInfo fi) {
-      assert !byName.containsKey(fi.name);
-      assert globalFieldNumbers.containsConsistent(Integer.valueOf(fi.number), fi.name, fi.getDocValuesType());
-      byName.put(fi.name, fi);
-    }
-
     /** NOTE: this method does not carry over termVector
      *  booleans nor docValuesType; the indexer chain
      *  (TermVectorsConsumerPerField, DocFieldProcessor) must
@@ -296,9 +287,16 @@ public class FieldInfos implements Itera
         boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType
docValues, DocValuesType normType) {
       FieldInfo fi = fieldInfo(name);
       if (fi == null) {
-        // get a global number for this field
+        // This field wasn't yet added to this in-RAM
+        // segment's FieldInfo, so now we get a global
+        // number for this field.  If the field was seen
+        // before then we'll get the same name and number,
+        // else we'll allocate a new one:
         final int fieldNumber = globalFieldNumbers.addOrGet(name, preferredFieldNumber, docValues);
-        fi = addInternal(name, fieldNumber, isIndexed, storeTermVector, omitNorms, storePayloads,
indexOptions, docValues, normType);
+        fi = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads,
indexOptions, docValues, normType, null);
+        assert !byName.containsKey(fi.name);
+        assert globalFieldNumbers.containsConsistent(Integer.valueOf(fi.number), fi.name,
fi.getDocValuesType());
+        byName.put(fi.name, fi);
       } else {
         fi.update(isIndexed, storeTermVector, omitNorms, storePayloads, indexOptions);
 
@@ -320,15 +318,6 @@ public class FieldInfos implements Itera
                  fi.getIndexOptions(), fi.getDocValuesType(), fi.getNormType());
     }
     
-    private FieldInfo addInternal(String name, int fieldNumber, boolean isIndexed,
-                                  boolean storeTermVector, boolean omitNorms, boolean storePayloads,
-                                  IndexOptions indexOptions, DocValuesType docValuesType,
DocValuesType normType) {
-      globalFieldNumbers.setIfNotSet(fieldNumber, name, docValuesType);
-      final FieldInfo fi = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms,
storePayloads, indexOptions, docValuesType, normType, null);
-      putInternal(fi);
-      return fi;
-    }
-
     public FieldInfo fieldInfo(String fieldName) {
       return byName.get(fieldName);
     }



Mime
View raw message