Index: lucene/src/java/org/apache/lucene/search/AutomatonTermsEnum.java =================================================================== --- lucene/src/java/org/apache/lucene/search/AutomatonTermsEnum.java (revision 1067464) +++ lucene/src/java/org/apache/lucene/search/AutomatonTermsEnum.java (working copy) @@ -17,8 +17,13 @@ * limitations under the License. */ +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; import java.util.Comparator; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; @@ -70,6 +75,11 @@ private final BytesRef linearUpperBound = new BytesRef(10); private final Comparator termComp; + // nocommit + public static final AtomicInteger iteration = new AtomicInteger(0); + public static final AtomicInteger testIteration = new AtomicInteger(0); + private final PrintStream log; + /** * Expert ctor: * Construct an enumerator based upon an automaton, enumerating the specified @@ -106,6 +116,9 @@ visited = new long[runAutomaton.getSize()]; termComp = getComparator(); + OutputStream os = new FileOutputStream(new File("c:/work/bug/seeks" + + testIteration.get() + "_" + iteration.incrementAndGet() + ".txt")); + log = new PrintStream(os, true); } /** @@ -148,13 +161,14 @@ } else { seekBytesRef.copy(term); } - + log.println("got:" + term); // seek to the next possible string; if (nextString()) { // reposition if (linear) setLinear(infinitePosition); + log.println("seek:" + term); return seekBytesRef; } // no more possible strings can match Index: lucene/contrib/queries/src/test/org/apache/lucene/search/TestFieldCacheRewriteMethod.java =================================================================== --- lucene/contrib/queries/src/test/org/apache/lucene/search/TestFieldCacheRewriteMethod.java (revision 1067464) +++ lucene/contrib/queries/src/test/org/apache/lucene/search/TestFieldCacheRewriteMethod.java (working copy) @@ -30,9 +30,14 @@ /** Test fieldcache rewrite against filter rewrite */ @Override protected void assertSame(String regexp) throws IOException { + // nocommit + AutomatonTermsEnum.testIteration.incrementAndGet(); + System.out.println("running"); + regexp ="-.]|[[+?.\u5197\u2F8F?]+*."; RegexpQuery fieldCache = new RegexpQuery(new Term("field", regexp), RegExp.NONE); - fieldCache.setRewriteMethod(new FieldCacheRewriteMethod()); - + // nocommit + // fieldCache.setRewriteMethod(new FieldCacheRewriteMethod()); + fieldCache.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE); RegexpQuery filter = new RegexpQuery(new Term("field", regexp), RegExp.NONE); filter.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);