lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1722196 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/CHANGES.txt lucene/misc/ lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java
Date Tue, 29 Dec 2015 17:47:16 GMT
Author: rmuir
Date: Tue Dec 29 17:47:14 2015
New Revision: 1722196

URL: http://svn.apache.org/viewvc?rev=1722196&view=rev
Log:
LUCENE-6950: Fix FieldInfos handling of UninvertingReader

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/lucene/misc/   (props changed)
    lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java
    lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java

Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1722196&r1=1722195&r2=1722196&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Tue Dec 29 17:47:14 2015
@@ -67,6 +67,10 @@ Bug Fixes
 * LUCENE-6946: SortField.equals now takes the missingValue parameter into
   account. (Adrien Grand)
 
+* LUCENE-6950: Fix FieldInfos handling of UninvertingReader, e.g. do not
+  hide the true docvalues update generation or other properties. 
+  (Ishan Chattopadhyaya via Robert Muir)
+
 Other
 
 * LUCENE-6924: Upgrade randomizedtesting to 2.3.2. (Dawid Weiss)

Modified: lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java?rev=1722196&r1=1722195&r2=1722196&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java
Tue Dec 29 17:47:14 2015
@@ -216,7 +216,7 @@ public class UninvertingReader extends F
         }
       }
       filteredInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),
-                                      fi.hasPayloads(), fi.getIndexOptions(), type, -1, Collections.<String,String>emptyMap()));
+                                      fi.hasPayloads(), fi.getIndexOptions(), type, fi.getDocValuesGen(),
fi.attributes()));
     }
     fieldInfos = new FieldInfos(filteredInfos.toArray(new FieldInfo[filteredInfos.size()]));
   }

Modified: lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java?rev=1722196&r1=1722195&r2=1722196&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java
Tue Dec 29 17:47:14 2015
@@ -19,6 +19,7 @@ package org.apache.lucene.uninverting;
 
 import java.io.IOException;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -30,7 +31,13 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.IntField;
 import org.apache.lucene.document.LongField;
+import org.apache.lucene.document.NumericDocValuesField;
+import org.apache.lucene.document.StoredField;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValuesType;
+import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.LeafReader;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.DirectoryReader;
@@ -338,5 +345,43 @@ public class TestUninvertingReader exten
     ir.close();
     dir.close();
   }
+
+  public void testFieldInfos() throws IOException {
+    Directory dir = newDirectory();
+    IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(null));
+
+    Document doc = new Document();
+    BytesRef idBytes = new BytesRef("id");
+    doc.add(new StringField("id", idBytes, Store.YES));
+    doc.add(new IntField("int", 5, Store.YES));
+    doc.add(new NumericDocValuesField("dv", 5));
+    doc.add(new StoredField("stored", 5)); // not indexed
+    iw.addDocument(doc);
+
+    iw.forceMerge(1);
+    iw.close();
+
+    Map<String, Type> uninvertingMap = new HashMap<>();
+    uninvertingMap.put("int", Type.INTEGER);
+    uninvertingMap.put("dv", Type.INTEGER);
+
+    DirectoryReader ir = UninvertingReader.wrap(DirectoryReader.open(dir), 
+                         uninvertingMap);
+    LeafReader leafReader = ir.leaves().get(0).reader();
+
+    FieldInfo intFInfo = leafReader.getFieldInfos().fieldInfo("int");
+    assertEquals(DocValuesType.NUMERIC, intFInfo.getDocValuesType());
+
+    FieldInfo dvFInfo = leafReader.getFieldInfos().fieldInfo("dv");
+    assertEquals(DocValuesType.NUMERIC, dvFInfo.getDocValuesType());
+    assertEquals("0", dvFInfo.getAttribute("PerFieldDocValuesFormat.suffix"));
+
+    FieldInfo storedFInfo = leafReader.getFieldInfos().fieldInfo("stored");
+    assertEquals(DocValuesType.NONE, storedFInfo.getDocValuesType());
+
+    TestUtil.checkReader(ir);
+    ir.close();
+    dir.close();
+  }
 
 }



Mime
View raw message