lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chr...@apache.org
Subject svn commit: r1175685 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLongPostings.java
Date Mon, 26 Sep 2011 06:12:53 GMT
Author: chrism
Date: Mon Sep 26 06:12:53 2011
New Revision: 1175685

URL: http://svn.apache.org/viewvc?rev=1175685&view=rev
Log:
LUCENE-3455: Fixed TestLongPostings

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

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLongPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLongPostings.java?rev=1175685&r1=1175684&r2=1175685&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLongPostings.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLongPostings.java Mon Sep
26 06:12:53 2011
@@ -50,18 +50,26 @@ public class TestLongPostings extends Lu
       final TokenStream ts = a.reusableTokenStream("foo", new StringReader(s));
       final TermToBytesRefAttribute termAtt = ts.getAttribute(TermToBytesRefAttribute.class);
       final BytesRef termBytes = termAtt.getBytesRef();
-      int count = 0;
       ts.reset();
+
+      int count = 0;
+      boolean changed = false;
+
       while(ts.incrementToken()) {
         termAtt.fillBytesRef();
         if (count == 0 && !termBytes.utf8ToString().equals(s)) {
-          break;
+          // The value was changed during analysis.  Keep iterating so the
+          // tokenStream is exhausted.
+          changed = true;
         }
         count++;
       }
+
       ts.end();
       ts.close();
-      if (count == 1) {
+
+      // Did we iterate just once and the value was unchanged?
+      if (!changed && count == 1) {
         return s;
       }
     }



Mime
View raw message