lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1432055 - in /lucene/dev/branches/lucene4547/lucene: core/src/java/org/apache/lucene/index/ core/src/test/org/apache/lucene/index/ test-framework/src/java/org/apache/lucene/index/
Date Fri, 11 Jan 2013 14:00:00 GMT
Author: rmuir
Date: Fri Jan 11 13:59:59 2013
New Revision: 1432055

URL: http://svn.apache.org/viewvc?rev=1432055&view=rev
Log:
cleanups and fix for testduelingcodecs fail

Modified:
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java
    lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java
    lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/index/MultiSimpleDocValues.java

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
Fri Jan 11 13:59:59 2013
@@ -606,5 +606,43 @@ class MultiDocValues extends DocValues {
     return new MultiSource(slices, starts, true, type);
   }
   
+  public static NumericDocValues simpleNormValues(final IndexReader r, final String field)
throws IOException {
+    FieldInfo fi = MultiFields.getMergedFieldInfos(r).fieldInfo(field);
+    if (fi == null || fi.hasNorms() == false) {
+      return null;
+    }
+    final List<AtomicReaderContext> leaves = r.leaves();
+    boolean anyReal = false;
+    for(AtomicReaderContext ctx : leaves) {
+      NumericDocValues norms = ctx.reader().simpleNormValues(field);
+
+      if (norms == null) {
+        norms = NumericDocValues.EMPTY;
+      } else {
+        anyReal = true;
+      }
+    }
+    
+    assert anyReal; // nocommit: is this assert safe?
+
+    return new NumericDocValues() {
+      @Override
+      public long get(int docID) {
+        int subIndex = ReaderUtil.subIndex(docID, leaves);
+        NumericDocValues norms;
+        try {
+          norms = leaves.get(subIndex).reader().simpleNormValues(field);
+        } catch (IOException ioe) {
+          throw new RuntimeException(ioe);
+        }
+        if (norms == null) { // WTF? should be EMPTY?
+          return 0;
+        } else {
+          return norms.get(docID - leaves.get(subIndex).docBase);
+        }
+      }
+    };
+  }
+  
   
 }

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java
Fri Jan 11 13:59:59 2013
@@ -61,15 +61,7 @@ final class NormsConsumerPerField extend
       }
 
       long norm = similarity.computeSimpleNorm(fieldState);
-      if (norm != -1) {
-        // nocommit is -1 really a safe "not set" value!?
-        // nocommit shouldn't we require that it's either
-        // all -1's or none?  a sim can't not compute norms
-        // for only some docs?  hmm unless the field is
-        // missing for this doc... but then finish() isn't
-        // called?
-        simpleNormsWriter.addValue(docState.docID, norm);
-      }
+      simpleNormsWriter.addValue(docState.docID, norm);
     }
   }
   

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java
Fri Jan 11 13:59:59 2013
@@ -281,7 +281,7 @@ final class SegmentCoreReaders {
       // Field does not exist
       return null;
     }
-    if (!fi.isIndexed() || fi.omitsNorms()) {
+    if (!fi.hasNorms()) {
       return null;
     }
     // nocommit change to assert != null!!

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java
Fri Jan 11 13:59:59 2013
@@ -228,7 +228,7 @@ final class SegmentMerger {
       boolean success = false;
       try {
         for (FieldInfo field : mergeState.fieldInfos) {
-          if (field.isIndexed() && !field.omitsNorms() && field.getNormType()
!= null) {
+          if (field.hasNorms()) {
             List<NumericDocValues> toMerge = new ArrayList<NumericDocValues>();
             for (AtomicReader reader : mergeState.readers) {
               NumericDocValues norms = reader.simpleNormValues(field.name);

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java
Fri Jan 11 13:59:59 2013
@@ -91,19 +91,19 @@ public final class SlowCompositeReaderWr
   @Override
   public NumericDocValues getNumericDocValues(String field) throws IOException {
     ensureOpen();
-    return null;
+    return null; // nocommit: UOE
   }
 
   @Override
   public BinaryDocValues getBinaryDocValues(String field) throws IOException {
     ensureOpen();
-    return null;
+    return null; // nocommit: UOE
   }
 
   @Override
   public SortedDocValues getSortedDocValues(String field) throws IOException {
     ensureOpen();
-    return null;
+    return null; // nocommit: UOE
   }
   
   @Override
@@ -121,7 +121,7 @@ public final class SlowCompositeReaderWr
   public NumericDocValues simpleNormValues(String field) throws IOException {
     ensureOpen();
     // nocommit hmm
-    return null;
+    return MultiDocValues.simpleNormValues(in, field);
   }
   
   @Override

Modified: lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java
Fri Jan 11 13:59:59 2013
@@ -537,10 +537,8 @@ public class TestDuelingCodecs extends L
       if (leftNorms != null && rightNorms != null) {
         assertDocValues(leftReader.maxDoc(), leftNorms, rightNorms);
       } else {
-        // nocommit: figure out WTF is going on here, maybe a bug in MultiSimpleDocValues?
-        // ant test  -Dtestcase=TestDuelingCodecs -Dtests.method=testEquals -Dtests.seed=CCA808E6ADF64354
-Dtests.slow=true -Dtests.codec=Lucene41 -Dtests.locale=en_GB -Dtests.timezone=Asia/Pyongyang
-Dtests.file.encoding=US-ASCII
-        assertNull(leftNorms);
-        assertNull(rightNorms);
+        assertNull(info, leftNorms);
+        assertNull(info, rightNorms);
       }
     }
   }

Modified: lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/index/MultiSimpleDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/index/MultiSimpleDocValues.java?rev=1432055&r1=1432054&r2=1432055&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/index/MultiSimpleDocValues.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/test-framework/src/java/org/apache/lucene/index/MultiSimpleDocValues.java
Fri Jan 11 13:59:59 2013
@@ -23,41 +23,10 @@ import java.util.List;
 import org.apache.lucene.util.BytesRef;
 
 public class MultiSimpleDocValues {
-
+  
+  // moved to src/java so SlowWrapper can use it... uggggggh
   public static NumericDocValues simpleNormValues(final IndexReader r, final String field)
throws IOException {
-    final List<AtomicReaderContext> leaves = r.leaves();
-    boolean anyReal = false;
-    for(AtomicReaderContext ctx : leaves) {
-      NumericDocValues norms = ctx.reader().simpleNormValues(field);
-
-      if (norms == null) {
-        norms = NumericDocValues.EMPTY;
-      } else {
-        anyReal = true;
-      }
-    }
-
-    if (!anyReal) {
-      return null;
-    } else {
-      return new NumericDocValues() {
-        @Override
-        public long get(int docID) {
-          int subIndex = ReaderUtil.subIndex(docID, leaves);
-          NumericDocValues norms;
-          try {
-            norms = leaves.get(subIndex).reader().simpleNormValues(field);
-          } catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-          }
-          if (norms == null) {
-            return 0;
-          } else {
-            return norms.get(docID - leaves.get(subIndex).docBase);
-          }
-        }
-      };
-    }
+    return MultiDocValues.simpleNormValues(r, field);
   }
 
   public static NumericDocValues simpleNumericValues(final IndexReader r, final String field)
throws IOException {



Mime
View raw message