You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/07/23 17:58:25 UTC

svn commit: r1364693 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java

Author: rmuir
Date: Mon Jul 23 15:58:24 2012
New Revision: 1364693

URL: http://svn.apache.org/viewvc?rev=1364693&view=rev
Log:
LUCENE-3892: fix producer in this test to pass -1 if we arent indexing offsets

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java?rev=1364693&r1=1364692&r2=1364693&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java Mon Jul 23 15:58:24 2012
@@ -386,6 +386,7 @@ public class TestPostingsFormat extends 
       boolean doFreq = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
       boolean doPos = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
       boolean doPayloads = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
+      boolean doOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
       
       TermsConsumer termsConsumer = fieldsConsumer.addField(fieldInfo);
       long sumTotalTF = 0;
@@ -417,7 +418,7 @@ public class TestPostingsFormat extends 
                   System.out.println("      pos=" + pos.position);
                 }
               }
-              postingsConsumer.addPosition(pos.position, (doPayloads && pos.payload != null) ? new BytesRef(pos.payload) : null, pos.startOffset, pos.endOffset);
+              postingsConsumer.addPosition(pos.position, (doPayloads && pos.payload != null) ? new BytesRef(pos.payload) : null, doOffsets ? pos.startOffset : -1, doOffsets ? pos.endOffset : -1);
             }
           } else if (doFreq) {
             totalTF += posting.positions.size();