lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1635000 - in /lucene/dev/branches/lucene6005/lucene/core/src: java/org/apache/lucene/document/ java/org/apache/lucene/index/ test/org/apache/lucene/document/ test/org/apache/lucene/search/
Date Tue, 28 Oct 2014 22:43:55 GMT
Author: mikemccand
Date: Tue Oct 28 22:43:54 2014
New Revision: 1635000

URL: http://svn.apache.org/r1635000
Log:
LUCENE-6005: fix test failures

Modified:
    lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/document/FieldTypes.java
    lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/document/TestDocument2.java
    lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/TestBooleanCoord.java

Modified: lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/document/FieldTypes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/document/FieldTypes.java?rev=1635000&r1=1634999&r2=1635000&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/document/FieldTypes.java
(original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/document/FieldTypes.java
Tue Oct 28 22:43:54 2014
@@ -197,8 +197,9 @@ public class FieldTypes {
     FLOAT,
     LONG,
     DOUBLE,
-    BINARY,
+    BINARY, // nocommit rename to bytes?
     // nocommit primary_key?
+    // nocommit boolean
   }
 
   private final boolean readOnly;
@@ -1075,7 +1076,12 @@ public class FieldTypes {
     public int getPositionIncrementGap(String fieldName) {
       FieldType field = fields.get(fieldName);
       if (field == null) {
-        return defaultIndexAnalyzer.getPositionIncrementGap(fieldName);
+        if (defaultIndexAnalyzer == null) {
+          // nocommit sheisty
+          return 0;
+        } else {
+          return defaultIndexAnalyzer.getPositionIncrementGap(fieldName);
+        }
       }
       if (field.analyzerPositionGap != null) {
         return field.analyzerPositionGap.intValue();
@@ -1090,7 +1096,12 @@ public class FieldTypes {
     public int getOffsetGap(String fieldName) {
       FieldType field = fields.get(fieldName);
       if (field == null) {
-        return defaultIndexAnalyzer.getOffsetGap(fieldName);
+        if (defaultIndexAnalyzer == null) {
+          // nocommit sheisty
+          return 1;
+        } else {
+          return defaultIndexAnalyzer.getOffsetGap(fieldName);
+        }
       }
       if (field.analyzerOffsetGap != null) {
         return field.analyzerOffsetGap.intValue();

Modified: lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1635000&r1=1634999&r2=1635000&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
(original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
Tue Oct 28 22:43:54 2014
@@ -42,6 +42,7 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.codecs.FieldInfosFormat;
+import org.apache.lucene.codecs.lucene50.Lucene50Codec;
 import org.apache.lucene.document.Document2;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.FieldTypes;
@@ -862,7 +863,7 @@ public class IndexWriter implements Clos
       analyzer = fieldTypes.getIndexAnalyzer();
 
       // nocommit what to do here... cannot delegate codecs
-      if (config.getCodec() != Codec.getDefault()) {
+      if ((config.getCodec() instanceof Lucene50Codec) == false) {
         codec = config.getCodec();
       } else {
         codec = fieldTypes.getCodec();

Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/document/TestDocument2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/document/TestDocument2.java?rev=1635000&r1=1634999&r2=1635000&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/document/TestDocument2.java
(original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/document/TestDocument2.java
Tue Oct 28 22:43:54 2014
@@ -22,7 +22,9 @@ import java.io.StringReader;
 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
 import org.apache.lucene.analysis.CannedTokenStream;
 import org.apache.lucene.analysis.MockAnalyzer;
+import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.codecs.blocktree.Stats;
+import org.apache.lucene.codecs.lucene50.Lucene50Codec;
 import org.apache.lucene.index.CheckIndex;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.FieldInfo.DocValuesType;
@@ -50,6 +52,11 @@ import org.apache.lucene.util.Version;
 
 public class TestDocument2 extends LuceneTestCase {
 
+  public void setUp() throws Exception {
+    super.setUp();
+    Codec.setDefault(new Lucene50Codec());
+  }
+
   public void testBasic() throws Exception {
     Directory dir = newDirectory();
 

Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/TestBooleanCoord.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/TestBooleanCoord.java?rev=1635000&r1=1634999&r2=1635000&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/TestBooleanCoord.java
(original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/TestBooleanCoord.java
Tue Oct 28 22:43:54 2014
@@ -48,8 +48,7 @@ public class TestBooleanCoord extends Lu
   @BeforeClass
   public static void beforeClass() throws Exception {
     dir = newDirectory();
-    // nocommit behavior change
-    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(new MockAnalyzer(random())));
+    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(null));
     
     // we only add two documents for testing:
     // the first document has 3 terms A,B,C (for positive matching). we test scores against
this.



Mime
View raw message