Index: lucene/src/test/org/apache/lucene/TestMergeSchedulerExternal.java =================================================================== --- lucene/src/test/org/apache/lucene/TestMergeSchedulerExternal.java (revision 943145) +++ lucene/src/test/org/apache/lucene/TestMergeSchedulerExternal.java (working copy) @@ -23,7 +23,7 @@ import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.MergePolicy; import org.apache.lucene.index.ConcurrentMergeScheduler; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -88,7 +88,7 @@ doc.add(idField); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMergeScheduler(new MyMergeScheduler()) + TEST_VERSION_CURRENT, new _TestAnalyzer()).setMergeScheduler(new MyMergeScheduler()) .setMaxBufferedDocs(2).setRAMBufferSizeMB( IndexWriterConfig.DISABLE_AUTO_FLUSH)); for(int i=0;i<20;i++) Index: lucene/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java =================================================================== --- lucene/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java (revision 943145) +++ lucene/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java (working copy) @@ -24,7 +24,7 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; @@ -71,7 +71,7 @@ public void testSimple() throws Exception { String[] fields = {"b", "t"}; - MultiFieldQueryParser mfqp = new MultiFieldQueryParser(TEST_VERSION_CURRENT, fields, new StandardAnalyzer(TEST_VERSION_CURRENT)); + MultiFieldQueryParser mfqp = new MultiFieldQueryParser(TEST_VERSION_CURRENT, fields, new _TestAnalyzer()); Query q = mfqp.parse("one"); assertEquals("b:one t:one", q.toString()); @@ -134,7 +134,7 @@ boosts.put("b", Float.valueOf(5)); boosts.put("t", Float.valueOf(10)); String[] fields = {"b", "t"}; - MultiFieldQueryParser mfqp = new MultiFieldQueryParser(TEST_VERSION_CURRENT, fields, new StandardAnalyzer(TEST_VERSION_CURRENT), boosts); + MultiFieldQueryParser mfqp = new MultiFieldQueryParser(TEST_VERSION_CURRENT, fields, new _TestAnalyzer(), boosts); //Check for simple @@ -160,24 +160,24 @@ public void testStaticMethod1() throws ParseException { String[] fields = {"b", "t"}; String[] queries = {"one", "two"}; - Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, new StandardAnalyzer(TEST_VERSION_CURRENT)); + Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, new _TestAnalyzer()); assertEquals("b:one t:two", q.toString()); String[] queries2 = {"+one", "+two"}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries2, fields, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries2, fields, new _TestAnalyzer()); assertEquals("(+b:one) (+t:two)", q.toString()); String[] queries3 = {"one", "+two"}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries3, fields, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries3, fields, new _TestAnalyzer()); assertEquals("b:one (+t:two)", q.toString()); String[] queries4 = {"one +more", "+two"}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries4, fields, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries4, fields, new _TestAnalyzer()); assertEquals("(b:one +b:more) (+t:two)", q.toString()); String[] queries5 = {"blah"}; try { - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries5, fields, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries5, fields, new _TestAnalyzer()); fail(); } catch(IllegalArgumentException e) { // expected exception, array length differs @@ -199,15 +199,15 @@ public void testStaticMethod2() throws ParseException { String[] fields = {"b", "t"}; BooleanClause.Occur[] flags = {BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT}; - Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one", fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT)); + Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one", fields, flags, new _TestAnalyzer()); assertEquals("+b:one -t:one", q.toString()); - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one two", fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one two", fields, flags, new _TestAnalyzer()); assertEquals("+(b:one b:two) -(t:one t:two)", q.toString()); try { BooleanClause.Occur[] flags2 = {BooleanClause.Occur.MUST}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "blah", fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "blah", fields, flags2, new _TestAnalyzer()); fail(); } catch(IllegalArgumentException e) { // expected exception, array length differs @@ -219,15 +219,15 @@ //int[] flags = {MultiFieldQueryParser.REQUIRED_FIELD, MultiFieldQueryParser.PROHIBITED_FIELD}; BooleanClause.Occur[] flags = {BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT}; - Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one", fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT));//, fields, flags, new StandardAnalyzer()); + Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one", fields, flags, new _TestAnalyzer());//, fields, flags, new _TestAnalyzer()); assertEquals("+b:one -t:one", q.toString()); - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one two", fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "one two", fields, flags, new _TestAnalyzer()); assertEquals("+(b:one b:two) -(t:one t:two)", q.toString()); try { BooleanClause.Occur[] flags2 = {BooleanClause.Occur.MUST}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "blah", fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, "blah", fields, flags2, new _TestAnalyzer()); fail(); } catch(IllegalArgumentException e) { // expected exception, array length differs @@ -239,12 +239,12 @@ String[] fields = {"f1", "f2", "f3"}; BooleanClause.Occur[] flags = {BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT, BooleanClause.Occur.SHOULD}; - Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT)); + Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags, new _TestAnalyzer()); assertEquals("+f1:one -f2:two f3:three", q.toString()); try { BooleanClause.Occur[] flags2 = {BooleanClause.Occur.MUST}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags2, new _TestAnalyzer()); fail(); } catch(IllegalArgumentException e) { // expected exception, array length differs @@ -255,12 +255,12 @@ String[] queries = {"one", "two"}; String[] fields = {"b", "t"}; BooleanClause.Occur[] flags = {BooleanClause.Occur.MUST, BooleanClause.Occur.MUST_NOT}; - Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags, new StandardAnalyzer(TEST_VERSION_CURRENT)); + Query q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags, new _TestAnalyzer()); assertEquals("+b:one -t:two", q.toString()); try { BooleanClause.Occur[] flags2 = {BooleanClause.Occur.MUST}; - q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags2, new StandardAnalyzer(TEST_VERSION_CURRENT)); + q = MultiFieldQueryParser.parse(TEST_VERSION_CURRENT, queries, fields, flags2, new _TestAnalyzer()); fail(); } catch(IllegalArgumentException e) { // expected exception, array length differs @@ -282,7 +282,7 @@ } public void testStopWordSearching() throws Exception { - Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); Directory ramDir = new RAMDirectory(); IndexWriter iw = new IndexWriter(ramDir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); @@ -304,7 +304,7 @@ * Return empty tokens for field "f1". */ private static class AnalyzerReturningNull extends Analyzer { - StandardAnalyzer stdAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + _TestAnalyzer stdAnalyzer = new _TestAnalyzer(); public AnalyzerReturningNull() { } Index: lucene/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java (revision 943145) +++ lucene/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java (working copy) @@ -39,7 +39,7 @@ public void testCaching() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); TokenStream stream = new TokenStream() { private int index = 0; Index: lucene/src/test/org/apache/lucene/analysis/_TestTokenizer.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/_TestTokenizer.java (revision 0) +++ lucene/src/test/org/apache/lucene/analysis/_TestTokenizer.java (revision 0) @@ -0,0 +1,62 @@ +package org.apache.lucene.analysis; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.IOException; +import java.io.Reader; + +import org.apache.lucene.util.Version; +import org.apache.lucene.util.automaton.CharacterRunAutomaton; + +/** + * Automaton-based tokenizer for testing. Optionally lowercases. + */ +public class _TestTokenizer extends CharTokenizer { + private final CharacterRunAutomaton runAutomaton; + private final boolean lowerCase; + private int state; + + public _TestTokenizer(Reader input, CharacterRunAutomaton runAutomaton, boolean lowerCase) { + super(Version.LUCENE_CURRENT, input); + this.runAutomaton = runAutomaton; + this.lowerCase = lowerCase; + this.state = runAutomaton.getInitialState(); + } + + @Override + protected boolean isTokenChar(int c) { + state = runAutomaton.step(state, c); + if (state < 0) { + state = runAutomaton.getInitialState(); + return false; + } else { + return true; + } + } + + @Override + protected int normalize(int c) { + return lowerCase ? Character.toLowerCase(c) : c; + } + + @Override + public void reset() throws IOException { + super.reset(); + state = runAutomaton.getInitialState(); + } +} Property changes on: lucene\src\test\org\apache\lucene\analysis\_TestTokenizer.java ___________________________________________________________________ Added: svn:eol-style + native Index: lucene/src/test/org/apache/lucene/analysis/_TestAnalyzer.java =================================================================== --- lucene/src/test/org/apache/lucene/analysis/_TestAnalyzer.java (revision 0) +++ lucene/src/test/org/apache/lucene/analysis/_TestAnalyzer.java (revision 0) @@ -0,0 +1,64 @@ +package org.apache.lucene.analysis; + +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.IOException; +import java.io.Reader; + +import org.apache.lucene.util.automaton.CharacterRunAutomaton; +import org.apache.lucene.util.automaton.RegExp; + +/** + * Analyzer for testing + */ +public final class _TestAnalyzer extends Analyzer { + public static final CharacterRunAutomaton WHITESPACE = + new CharacterRunAutomaton(new RegExp("[^ \t\r\n]+").toAutomaton()); + public static final CharacterRunAutomaton KEYWORD = + new CharacterRunAutomaton(new RegExp(".*").toAutomaton()); + + private final CharacterRunAutomaton runAutomaton; + private final boolean lowerCase; + + public _TestAnalyzer(CharacterRunAutomaton runAutomaton, boolean lowerCase) { + this.runAutomaton = runAutomaton; + this.lowerCase = lowerCase; + } + + public _TestAnalyzer() { + this(WHITESPACE, true); + } + + @Override + public TokenStream tokenStream(String fieldName, Reader reader) { + return new _TestTokenizer(reader, runAutomaton, lowerCase); + } + + @Override + public TokenStream reusableTokenStream(String fieldName, Reader reader) + throws IOException { + _TestTokenizer t = (_TestTokenizer) getPreviousTokenStream(); + if (t == null) { + t = new _TestTokenizer(reader, runAutomaton, lowerCase); + setPreviousTokenStream(t); + } else { + t.reset(reader); + } + return t; + } +} \ No newline at end of file Property changes on: lucene\src\test\org\apache\lucene\analysis\_TestAnalyzer.java ___________________________________________________________________ Added: svn:eol-style + native Index: lucene/src/test/org/apache/lucene/TestExternalCodecs.java =================================================================== --- lucene/src/test/org/apache/lucene/TestExternalCodecs.java (revision 943145) +++ lucene/src/test/org/apache/lucene/TestExternalCodecs.java (working copy) @@ -806,7 +806,7 @@ Directory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, - new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer()).setCodecProvider(new MyCodecs())); + new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setCodecProvider(new MyCodecs())); w.setMergeFactor(3); Document doc = new Document(); Index: lucene/src/test/org/apache/lucene/TestSearch.java =================================================================== --- lucene/src/test/org/apache/lucene/TestSearch.java (revision 943145) +++ lucene/src/test/org/apache/lucene/TestSearch.java (working copy) @@ -72,7 +72,7 @@ private void doTestSearch(PrintWriter out, boolean useCompoundFile) throws Exception { Directory directory = new RAMDirectory(); - Analyzer analyzer = new SimpleAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer); LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy(); lmp.setUseCompoundFile(useCompoundFile); Index: lucene/src/test/org/apache/lucene/store/TestLockFactory.java =================================================================== --- lucene/src/test/org/apache/lucene/store/TestLockFactory.java (revision 943145) +++ lucene/src/test/org/apache/lucene/store/TestLockFactory.java (working copy) @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.Map; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; @@ -49,7 +49,7 @@ // Lock prefix should have been set: assertTrue("lock prefix was not set by the RAMDirectory", lf.lockPrefixSet); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); // add 100 documents (so that commit lock is used) for (int i = 0; i < 100; i++) { @@ -81,13 +81,13 @@ assertTrue("RAMDirectory.setLockFactory did not take", NoLockFactory.class.isInstance(dir.getLockFactory())); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.commit(); // required so the second open succeed // Create a 2nd IndexWriter. This is normally not allowed but it should run through since we're not // using any locks: IndexWriter writer2 = null; try { - writer2 = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer2 = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); } catch (Exception e) { e.printStackTrace(System.out); fail("Should not have hit an IOException with no locking"); @@ -107,12 +107,12 @@ assertTrue("RAMDirectory did not use correct LockFactory: got " + dir.getLockFactory(), SingleInstanceLockFactory.class.isInstance(dir.getLockFactory())); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); // Create a 2nd IndexWriter. This should fail: IndexWriter writer2 = null; try { - writer2 = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer2 = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); fail("Should have hit an IOException with two IndexWriters on default SingleInstanceLockFactory"); } catch (IOException e) { } @@ -148,7 +148,7 @@ FSDirectory fs1 = FSDirectory.open(indexDir, lockFactory); // First create a 1 doc index: - IndexWriter w = new IndexWriter(fs1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)); + IndexWriter w = new IndexWriter(fs1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE)); addDoc(w); w.close(); @@ -276,7 +276,7 @@ IndexWriter writer = null; for(int i=0;i docs = new HashMap(); IndexWriter w = new MockIndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setRAMBufferSizeMB( + TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE).setRAMBufferSizeMB( 0.1).setMaxBufferedDocs(maxBufferedDocs)); w.commit(); LogMergePolicy lmp = (LogMergePolicy) w.getConfig().getMergePolicy(); @@ -201,7 +201,7 @@ Map docs = new HashMap(); for(int iter=0;iter<3;iter++) { IndexWriter w = new MockIndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE) + TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE) .setRAMBufferSizeMB(0.1).setMaxBufferedDocs(maxBufferedDocs).setMaxThreadStates(maxThreadStates) .setReaderPooling(doReaderPooling)); LogMergePolicy lmp = (LogMergePolicy) w.getConfig().getMergePolicy(); @@ -245,7 +245,7 @@ public static void indexSerial(Map docs, Directory dir) throws IOException { - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); // index all docs in a single thread Iterator iter = docs.values().iterator(); Index: lucene/src/test/org/apache/lucene/index/TestFlex.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestFlex.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestFlex.java (working copy) @@ -33,7 +33,7 @@ final int DOC_COUNT = 177; - IndexWriter w = new IndexWriter(d, new WhitespaceAnalyzer(), + IndexWriter w = new IndexWriter(d, new _TestAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); for(int iter=0;iter<2;iter++) { @@ -68,7 +68,7 @@ public void testTermOrd() throws Exception { Directory d = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(d, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); + IndexWriter w = new IndexWriter(d, new _TestAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); Document doc = new Document(); doc.add(new Field("f", "a b c", Field.Store.NO, Field.Index.ANALYZED)); w.addDocument(doc); Index: lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestSegmentTermDocs.java (working copy) @@ -21,7 +21,7 @@ import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.MockRAMDirectory; import org.apache.lucene.store.Directory; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -101,7 +101,7 @@ public void testSkipTo(int indexDivisor) throws IOException { Directory dir = new RAMDirectory(); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Term ta = new Term("content","aaa"); for(int i = 0; i < 10; i++) Index: lucene/src/test/org/apache/lucene/index/TestIndexWriter.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (working copy) @@ -37,11 +37,11 @@ import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.CachingTokenFilter; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.analysis.StopAnalyzer; import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenStream; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.analysis.WhitespaceTokenizer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.standard.StandardTokenizer; @@ -93,7 +93,7 @@ try { IndexWriterConfig.setDefaultWriteLockTimeout(2000); assertEquals(2000, IndexWriterConfig.getDefaultWriteLockTimeout()); - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); } finally { IndexWriterConfig.setDefaultWriteLockTimeout(savedWriteLockTimeout); } @@ -113,7 +113,7 @@ reader.close(); // test doc count before segments are merged/index is optimized - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); assertEquals(100, writer.maxDoc()); writer.close(); @@ -123,7 +123,7 @@ reader.close(); // optimize the index and check that the new doc count is correct - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); assertEquals(100, writer.maxDoc()); assertEquals(60, writer.numDocs()); writer.optimize(); @@ -139,7 +139,7 @@ // make sure opening a new index for create over // this existing one works correctly: - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE)); assertEquals(0, writer.maxDoc()); assertEquals(0, writer.numDocs()); writer.close(); @@ -180,7 +180,7 @@ long inputDiskUsage = 0; for(int i=0;i data = new HashMap(); @@ -4014,7 +4014,7 @@ assertEquals("test1", r.getCommitUserData().get("label")); r.close(); - w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); w.optimize(); w.close(); @@ -4025,7 +4025,7 @@ public void testOptimizeExceptions() throws IOException { RAMDirectory startDir = new MockRAMDirectory(); - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2); ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(100); IndexWriter w = new IndexWriter(startDir, conf); for(int i=0;i<27;i++) @@ -4034,7 +4034,7 @@ for(int i=0;i<200;i++) { MockRAMDirectory dir = new MockRAMDirectory(startDir); - conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); + conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()); ((ConcurrentMergeScheduler) conf.getMergeScheduler()).setSuppressExceptions(); w = new IndexWriter(dir, conf); dir.setRandomIOExceptionRate(0.5, 100); @@ -4055,8 +4055,7 @@ final List thrown = new ArrayList(); final IndexWriter writer = new IndexWriter(new MockRAMDirectory(), - new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer( - TEST_VERSION_CURRENT))) { + new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())) { @Override public void message(final String message) { if (message.startsWith("now flush at close") && 0 == thrown.size()) { @@ -4082,7 +4081,7 @@ public void testDoubleOffsetCounting() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); Field f = new Field("field", "abcd", Field.Store.NO, Field.Index.NOT_ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS); doc.add(f); @@ -4117,7 +4116,7 @@ // LUCENE-1442 public void testDoubleOffsetCounting2() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); Field f = new Field("field", "abcd", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS); doc.add(f); @@ -4139,7 +4138,7 @@ // LUCENE-1448 public void testEndOffsetPositionCharAnalyzer() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); Field f = new Field("field", "abcd ", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS); doc.add(f); @@ -4161,7 +4160,7 @@ // LUCENE-1448 public void testEndOffsetPositionWithCachingTokenFilter() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); - Analyzer analyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); TokenStream stream = new CachingTokenFilter(analyzer.tokenStream("field", new StringReader("abcd "))); @@ -4209,8 +4208,7 @@ public void testEndOffsetPositionStandard() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer( - TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); Field f = new Field("field", "abcd the ", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS); @@ -4241,8 +4239,7 @@ public void testEndOffsetPositionStandardEmptyField() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer( - TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); Field f = new Field("field", "", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS); @@ -4270,8 +4267,7 @@ public void testEndOffsetPositionStandardEmptyField2() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer( - TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); Field f = new Field("field", "abcd", Field.Store.NO, @@ -4313,7 +4309,7 @@ out.writeByte((byte) 42); out.close(); - new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))).close(); + new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())).close(); assertTrue(dir.fileExists("myrandomfile")); } finally { @@ -4324,7 +4320,7 @@ public void testDeadlock() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2)); Document doc = new Document(); doc.add(new Field("content", "aaa bbb ccc ddd eee fff ggg hhh iii", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); @@ -4335,7 +4331,7 @@ // index has 2 segments MockRAMDirectory dir2 = new MockRAMDirectory(); - IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer2.addDocument(doc); writer2.close(); @@ -4374,8 +4370,7 @@ w.close(); } IndexWriterConfig conf = new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer( - TEST_VERSION_CURRENT)).setMaxBufferedDocs(2); + TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2); ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(2); w = new IndexWriter(dir, conf); @@ -4484,7 +4479,7 @@ public void testIndexStoreCombos() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); byte[] b = new byte[50]; for(int i=0;i<50;i++) b[i] = (byte) (i+77); @@ -4546,7 +4541,7 @@ // LUCENE-1727: make sure doc fields are stored in order public void testStoredFieldsOrder() throws Throwable { Directory d = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("zzz", "a b c", Field.Store.YES, Field.Index.NO)); doc.add(new Field("aaa", "a b c", Field.Store.YES, Field.Index.NO)); @@ -4578,7 +4573,7 @@ public void testEmbeddedFFFF() throws Throwable { Directory d = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("field", "a a\uffffb", Field.Store.NO, Field.Index.ANALYZED)); w.addDocument(doc); @@ -4596,7 +4591,7 @@ public void testNoDocsIndex() throws Throwable { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy(); lmp.setUseCompoundFile(false); lmp.setUseCompoundDocStore(false); @@ -4617,7 +4612,7 @@ final double RUN_SEC = 0.5; final Directory dir = new MockRAMDirectory(); final IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); w.commit(); final AtomicBoolean failed = new AtomicBoolean(); Thread[] threads = new Thread[NUM_THREADS]; @@ -4739,7 +4734,7 @@ // sort in UTF16 sort order by default public void testTermUTF16SortOrder() throws Throwable { Directory dir = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); + IndexWriter writer = new IndexWriter(dir, new _TestAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); Document d = new Document(); // Single segment Field f = new Field("f", "", Field.Store.NO, Field.Index.NOT_ANALYZED); @@ -4804,7 +4799,7 @@ public void testIndexDivisor() throws Exception { Directory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); + IndexWriter w = new IndexWriter(dir, new _TestAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); StringBuilder s = new StringBuilder(); // must be > 256 for(int i=0;i<300;i++) { @@ -4833,7 +4828,7 @@ for(int iter=0;iter<2;iter++) { Directory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("field", "go", Field.Store.NO, Field.Index.ANALYZED)); w.addDocument(doc); @@ -4893,7 +4888,7 @@ Directory dir = new MockRAMDirectory(); SnapshotDeletionPolicy sdp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy()); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(sdp)); // First commit @@ -4935,7 +4930,7 @@ final Random r = newRandom(); Directory dir = new MockRAMDirectory(); - FlushCountingIndexWriter w = new FlushCountingIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setRAMBufferSizeMB(0.5)); + FlushCountingIndexWriter w = new FlushCountingIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setRAMBufferSizeMB(0.5)); //w.setInfoStream(System.out); Document doc = new Document(); doc.add(new Field("field", "go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20", Field.Store.NO, Field.Index.ANALYZED)); @@ -4969,7 +4964,7 @@ // changed since LUCENE-2386, where before IW would always commit on a fresh // new index. Directory dir = new RAMDirectory(); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); try { IndexReader.listCommits(dir); fail("listCommits should have thrown an exception over empty index"); @@ -4986,7 +4981,7 @@ // then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed // when listAll() was called in IndexFileDeleter. FSDirectory dir = FSDirectory.open(new File(TEMP_DIR, "emptyFSDirNoLock"), NoLockFactory.getNoLockFactory()); - new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))).close(); + new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())).close(); } public void testEmptyDirRollback() throws Exception { @@ -4995,7 +4990,7 @@ // files are left in the Directory. Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(2)); // Creating over empty dir should not create any files. assertEquals(0, dir.listAll().length); Index: lucene/src/test/org/apache/lucene/index/TestCheckIndex.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestCheckIndex.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestCheckIndex.java (working copy) @@ -25,7 +25,7 @@ import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.MockRAMDirectory; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.util.Constants; @@ -34,7 +34,7 @@ public void testDeletedDocs() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2)); Document doc = new Document(); doc.add(new Field("field", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); for(int i=0;i<19;i++) { Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (working copy) @@ -24,7 +24,7 @@ import org.apache.lucene.util._TestUtil; import org.apache.lucene.store.MockRAMDirectory; import org.apache.lucene.store.Directory; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -131,7 +131,7 @@ public void testRandomExceptions() throws Throwable { MockRAMDirectory dir = new MockRAMDirectory(); - MockIndexWriter writer = new MockIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setRAMBufferSizeMB(0.1)); + MockIndexWriter writer = new MockIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setRAMBufferSizeMB(0.1)); ((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).setSuppressExceptions(); //writer.setMaxBufferedDocs(10); writer.commit(); @@ -169,7 +169,7 @@ public void testRandomExceptionsThreads() throws Throwable { MockRAMDirectory dir = new MockRAMDirectory(); - MockIndexWriter writer = new MockIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setRAMBufferSizeMB(0.2)); + MockIndexWriter writer = new MockIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setRAMBufferSizeMB(0.2)); ((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).setSuppressExceptions(); //writer.setMaxBufferedDocs(10); writer.commit(); Index: lucene/src/test/org/apache/lucene/index/TestTransactions.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestTransactions.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestTransactions.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; import java.util.Random; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.store.Directory; @@ -93,13 +93,13 @@ @Override public void doWork() throws Throwable { - IndexWriter writer1 = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(3)); + IndexWriter writer1 = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(3)); ((LogMergePolicy) writer1.getConfig().getMergePolicy()).setMergeFactor(2); ((ConcurrentMergeScheduler) writer1.getConfig().getMergeScheduler()).setSuppressExceptions(); // Intentionally use different params so flush/merge // happen @ different times - IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)); + IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2)); ((LogMergePolicy) writer2.getConfig().getMergePolicy()).setMergeFactor(3); ((ConcurrentMergeScheduler) writer2.getConfig().getMergeScheduler()).setSuppressExceptions(); @@ -181,7 +181,7 @@ } public void initIndex(Directory dir) throws Throwable { - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); for(int j=0; j<7; j++) { Document d = new Document(); int n = RANDOM.nextInt(); Index: lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java (working copy) @@ -21,12 +21,11 @@ import java.io.Reader; import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenStream; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.analysis.WhitespaceTokenizer; -import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.tokenattributes.PayloadAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; @@ -61,7 +60,7 @@ public void testAddDocument() throws Exception { Document testDoc = new Document(); DocHelper.setupDoc(testDoc); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.addDocument(testDoc); writer.commit(); SegmentInfo info = writer.newestSegment(); @@ -207,8 +206,7 @@ public void testPreAnalyzedField() throws IOException { IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer( - TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("preanalyzed", new TokenStream() { @@ -268,8 +266,7 @@ doc.add(new Field("f2", "v2", Store.YES, Index.NOT_ANALYZED, TermVector.NO)); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer( - TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.addDocument(doc); writer.close(); @@ -303,8 +300,7 @@ doc.add(new Field("f2", "v2", Store.YES, Index.NO)); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer( - TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.addDocument(doc); writer.optimize(); // be sure to have a single segment writer.close(); Index: lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java (working copy) @@ -22,7 +22,7 @@ import org.apache.lucene.store.IndexInput; import org.apache.lucene.store.IndexOutput; import org.apache.lucene.store.RAMDirectory; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -42,7 +42,7 @@ Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(10)); int i; for(i=0;i<35;i++) { @@ -148,7 +148,7 @@ // Open & close a writer: it should delete the above 4 // files and nothing more: - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); writer.close(); String[] files2 = dir.listAll(); Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java (working copy) @@ -21,7 +21,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.store.FSDirectory; @@ -76,12 +76,12 @@ FSDirectory dir = FSDirectory.open(this.__test_dir); try { new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new StandardAnalyzer(TEST_VERSION_CURRENT)) + new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND)); } catch (FileNotFoundException e) { try { new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new StandardAnalyzer(TEST_VERSION_CURRENT)) + new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND)); } catch (FileNotFoundException e1) { } Index: lucene/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (working copy) @@ -20,7 +20,7 @@ import java.io.IOException; import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -42,7 +42,7 @@ IndexWriter writer = null; writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + new _TestAnalyzer()) .setOpenMode(OpenMode.CREATE)); // add 100 documents addDocs(writer, 100); @@ -50,7 +50,7 @@ writer.close(); _TestUtil.checkIndex(dir); - writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)); + writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file // add 40 documents in separate files @@ -58,14 +58,14 @@ assertEquals(40, writer.maxDoc()); writer.close(); - writer = newWriter(aux2, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)); + writer = newWriter(aux2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE)); // add 40 documents in compound files addDocs2(writer, 50); assertEquals(50, writer.maxDoc()); writer.close(); // test doc count before segments are merged - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); assertEquals(100, writer.maxDoc()); writer.addIndexesNoOptimize(new Directory[] { aux, aux2 }); assertEquals(190, writer.maxDoc()); @@ -80,14 +80,14 @@ // now add another set in. Directory aux3 = new RAMDirectory(); - writer = newWriter(aux3, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = newWriter(aux3, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); // add 40 documents addDocs(writer, 40); assertEquals(40, writer.maxDoc()); writer.close(); // test doc count before segments are merged/index is optimized - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); assertEquals(190, writer.maxDoc()); writer.addIndexesNoOptimize(new Directory[] { aux3 }); assertEquals(230, writer.maxDoc()); @@ -101,7 +101,7 @@ verifyTermDocs(dir, new Term("content", "bbb"), 50); // now optimize it. - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); writer.optimize(); writer.close(); @@ -114,11 +114,11 @@ // now add a single document Directory aux4 = new RAMDirectory(); - writer = newWriter(aux4, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = newWriter(aux4, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); addDocs2(writer, 1); writer.close(); - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); assertEquals(230, writer.maxDoc()); writer.addIndexesNoOptimize(new Directory[] { aux4 }); assertEquals(231, writer.maxDoc()); @@ -136,7 +136,7 @@ Directory aux = new MockRAMDirectory(); setUpDirs(dir, aux); - IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); writer.addIndexesNoOptimize(new Directory[] {aux}); @@ -174,7 +174,7 @@ Directory aux = new RAMDirectory(); setUpDirs(dir, aux); - IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); // Adds 10 docs, then replaces them with another 10 // docs, so 10 pending deletes: @@ -213,7 +213,7 @@ Directory aux = new RAMDirectory(); setUpDirs(dir, aux); - IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); // Adds 10 docs, then replaces them with another 10 // docs, so 10 pending deletes: @@ -254,25 +254,25 @@ IndexWriter writer = null; - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); // add 100 documents addDocs(writer, 100); assertEquals(100, writer.maxDoc()); writer.close(); - writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000)); + writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file // add 140 documents in separate files addDocs(writer, 40); writer.close(); - writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000)); + writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file addDocs(writer, 100); writer.close(); - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); try { // cannot add self writer.addIndexesNoOptimize(new Directory[] { aux, dir }); @@ -299,7 +299,7 @@ setUpDirs(dir, aux); IndexWriter writer = newWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4); addDocs(writer, 10); @@ -323,7 +323,7 @@ setUpDirs(dir, aux); - IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(9)); + IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(9)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4); addDocs(writer, 2); @@ -347,7 +347,7 @@ setUpDirs(dir, aux); IndexWriter writer = newWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(10)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4); @@ -377,7 +377,7 @@ reader.close(); IndexWriter writer = newWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(4)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4); @@ -401,7 +401,7 @@ setUpDirs(dir, aux); IndexWriter writer = newWriter(aux2, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(100)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10); writer.addIndexesNoOptimize(new Directory[] { aux }); @@ -423,7 +423,7 @@ assertEquals(22, reader.numDocs()); reader.close(); - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(6)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(4); @@ -482,14 +482,14 @@ private void setUpDirs(Directory dir, Directory aux) throws IOException { IndexWriter writer = null; - writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000)); + writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(1000)); // add 1000 documents in 1 segment addDocs(writer, 1000); assertEquals(1000, writer.maxDoc()); assertEquals(1, writer.getSegmentCount()); writer.close(); - writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(100)); + writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(100)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10); @@ -497,7 +497,7 @@ for (int i = 0; i < 3; i++) { addDocs(writer, 10); writer.close(); - writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(100)); + writer = newWriter(aux, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(100)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); // use one without a compound file ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(10); @@ -516,7 +516,7 @@ lmp.setUseCompoundDocStore(false); lmp.setMergeFactor(100); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(5).setMergePolicy(lmp)); Document doc = new Document(); @@ -545,7 +545,7 @@ lmp.setUseCompoundDocStore(false); lmp.setMergeFactor(4); writer = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + new _TestAnalyzer()) .setMergeScheduler(new SerialMergeScheduler()).setMergePolicy(lmp)); writer.addIndexesNoOptimize(new Directory[] {dir}); writer.close(); @@ -557,14 +557,14 @@ // is respected when copying tail segments public void testTargetCFS() throws IOException { Directory dir = new RAMDirectory(); - IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = newWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); addDocs(writer, 1); writer.close(); Directory other = new RAMDirectory(); - writer = newWriter(other, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = newWriter(other, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(true); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(true); writer.addIndexesNoOptimize(new Directory[] {dir}); Index: lucene/src/test/org/apache/lucene/index/TestNewestSegment.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestNewestSegment.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestNewestSegment.java (working copy) @@ -18,7 +18,7 @@ */ import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.index.IndexWriter.MaxFieldLength; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.util.LuceneTestCase; @@ -26,8 +26,8 @@ public class TestNewestSegment extends LuceneTestCase { public void testNewestSegment() throws Exception { RAMDirectory directory = new RAMDirectory(); - Analyzer analyzer = new SimpleAnalyzer(); - IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))); + Analyzer analyzer = new _TestAnalyzer(); + IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); assertNull(writer.newestSegment()); } } Index: lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (working copy) @@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; @@ -73,7 +73,7 @@ protected void setUp() throws Exception { super.setUp(); similarityOne = new SimilarityOne(); - anlzr = new StandardAnalyzer(TEST_VERSION_CURRENT); + anlzr = new _TestAnalyzer(); } /** Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java (working copy) @@ -26,7 +26,7 @@ import java.util.HashSet; import java.util.Set; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.index.DocumentsWriter.IndexingChain; import org.apache.lucene.index.IndexWriter.IndexReaderWarmer; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -65,8 +65,8 @@ @Test public void testDefaults() throws Exception { - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); - assertEquals(WhitespaceAnalyzer.class, conf.getAnalyzer().getClass()); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()); + assertEquals(_TestAnalyzer.class, conf.getAnalyzer().getClass()); assertNull(conf.getIndexCommit()); assertEquals(KeepOnlyLastCommitDeletionPolicy.class, conf.getIndexDeletionPolicy().getClass()); assertEquals(IndexWriterConfig.UNLIMITED_FIELD_LENGTH, conf.getMaxFieldLength()); @@ -144,7 +144,7 @@ @Test public void testToString() throws Exception { - String str = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).toString(); + String str = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).toString(); for (Field f : IndexWriterConfig.class.getDeclaredFields()) { int modifiers = f.getModifiers(); if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) { @@ -161,7 +161,7 @@ @Test public void testClone() throws Exception { - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()); IndexWriterConfig clone = (IndexWriterConfig) conf.clone(); // Clone is shallow since not all parameters are cloneable. @@ -173,7 +173,7 @@ @Test public void testInvalidValues() throws Exception { - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()); // Test IndexDeletionPolicy assertEquals(KeepOnlyLastCommitDeletionPolicy.class, conf.getIndexDeletionPolicy().getClass()); @@ -260,7 +260,7 @@ // whatever the user set on IW to IWC, so that if the user calls // iw.getConfig().getXYZ(), he'll get the same value he passed to // iw.setXYZ(). - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()); Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, conf); Index: lucene/src/test/org/apache/lucene/index/TestCrash.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestCrash.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestCrash.java (working copy) @@ -22,7 +22,7 @@ import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.store.MockRAMDirectory; import org.apache.lucene.store.NoLockFactory; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -35,7 +35,7 @@ private IndexWriter initIndex(MockRAMDirectory dir, boolean initialCommit) throws IOException { dir.setLockFactory(NoLockFactory.getNoLockFactory()); - IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10)); + IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(10)); ((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).setSuppressExceptions(); if (initialCommit) { writer.commit(); Index: lucene/src/test/org/apache/lucene/index/TestCodecs.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestCodecs.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestCodecs.java (working copy) @@ -22,7 +22,7 @@ import java.util.HashSet; import java.util.Random; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Store; @@ -344,7 +344,7 @@ public void testSepPositionAfterMerge() throws IOException { final Directory dir = new RAMDirectory(); final IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_31, - new WhitespaceAnalyzer(Version.LUCENE_31)); + new _TestAnalyzer()); config.setCodecProvider(new SepCodecs()); final IndexWriter writer = new IndexWriter(dir, config); Index: lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java (working copy) @@ -19,7 +19,7 @@ import org.apache.lucene.store.MockRAMDirectory; import org.apache.lucene.store.RAMDirectory; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -65,7 +65,7 @@ FailOnlyOnFlush failure = new FailOnlyOnFlush(); directory.failOn(failure); - IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)); + IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2)); Document doc = new Document(); Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED); doc.add(idField); @@ -115,7 +115,7 @@ // start: mp.setMinMergeDocs(1000); IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMergePolicy(mp)); Document doc = new Document(); @@ -149,7 +149,7 @@ RAMDirectory directory = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(2)); for(int iter=0;iter<7;iter++) { @@ -165,7 +165,7 @@ // Reopen writer = new IndexWriter(directory, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND).setMaxBufferedDocs(2)); } @@ -181,7 +181,7 @@ Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED); doc.add(idField); - IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)); + IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(100); for(int iter=0;iter<10;iter++) { @@ -210,7 +210,7 @@ reader.close(); // Reopen - writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.APPEND)); + writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.APPEND)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(100); } writer.close(); Index: lucene/src/test/org/apache/lucene/index/TestOmitTf.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestOmitTf.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestOmitTf.java (working copy) @@ -24,7 +24,7 @@ import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util._TestUtil; import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.search.*; @@ -61,7 +61,7 @@ // omitTermFreqAndPositions bit in the FieldInfo public void testOmitTermFreqAndPositions() throws Exception { Directory ram = new MockRAMDirectory(); - Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); Document d = new Document(); @@ -113,7 +113,7 @@ // omitTermFreqAndPositions for the same field works public void testMixedMerge() throws Exception { Directory ram = new MockRAMDirectory(); - Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(3)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); @@ -170,7 +170,7 @@ // field, public void testMixedRAM() throws Exception { Directory ram = new MockRAMDirectory(); - Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(10)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); @@ -218,7 +218,7 @@ // Verifies no *.prx exists when all fields omit term freq: public void testNoPrxFile() throws Throwable { Directory ram = new MockRAMDirectory(); - Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriter writer = new IndexWriter(ram, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(3)); LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy(); @@ -251,7 +251,7 @@ // Test scores with one field with Term Freqs and one without, otherwise with equal content public void testBasic() throws Exception { Directory dir = new MockRAMDirectory(); - Analyzer analyzer = new StandardAnalyzer(TEST_VERSION_CURRENT); + Analyzer analyzer = new _TestAnalyzer(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setMaxBufferedDocs(2) .setSimilarity(new SimpleSimilarity())); Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (working copy) @@ -19,7 +19,7 @@ import java.io.IOException; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -36,7 +36,7 @@ Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(10).setMergePolicy(new LogDocMergePolicy())); for (int i = 0; i < 100; i++) { @@ -52,7 +52,7 @@ Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(10).setMergePolicy(new LogDocMergePolicy())); boolean noOverMerge = false; @@ -76,7 +76,7 @@ mp.setMinMergeDocs(100); mp.setMergeFactor(10); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(10).setMergePolicy(mp)); for (int i = 0; i < 100; i++) { @@ -86,7 +86,7 @@ mp = new LogDocMergePolicy(); mp.setMergeFactor(10); writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(mp)); mp.setMinMergeDocs(100); checkInvariants(writer); @@ -100,7 +100,7 @@ Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(10).setMergePolicy(new LogDocMergePolicy())); for (int i = 0; i < 250; i++) { @@ -125,7 +125,7 @@ Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(101).setMergePolicy(new LogDocMergePolicy())); // leftmost* segment has 1 doc @@ -138,7 +138,7 @@ writer.close(); writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setMaxBufferedDocs(101).setMergePolicy( new LogDocMergePolicy())); } @@ -147,7 +147,7 @@ LogDocMergePolicy ldmp = new LogDocMergePolicy(); ldmp.setMergeFactor(10); writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(ldmp)); // merge policy only fixes segments on levels where merges @@ -175,7 +175,7 @@ LogDocMergePolicy ldmp = new LogDocMergePolicy(); ldmp.setMergeFactor(100); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(10).setMergePolicy(ldmp)); for (int i = 0; i < 250; i++) { @@ -191,7 +191,7 @@ ldmp = new LogDocMergePolicy(); ldmp.setMergeFactor(5); writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(ldmp)); // merge factor is changed, so check invariants after all adds Index: lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java (working copy) @@ -19,7 +19,7 @@ import org.apache.lucene.util.*; import org.apache.lucene.store.*; import org.apache.lucene.document.*; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import java.util.Random; import java.io.File; @@ -127,7 +127,7 @@ TimedThread[] threads = new TimedThread[4]; IndexWriterConfig conf = new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(7); ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(3); IndexWriter writer = new MockIndexWriter(directory, conf); Index: lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java (working copy) @@ -24,7 +24,7 @@ import java.lang.reflect.Modifier; import java.util.Arrays; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; @@ -75,7 +75,7 @@ public void testAllCommitsRemain() throws Exception { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(NoDeletionPolicy.INSTANCE)); for (int i = 0; i < 10; i++) { Document doc = new Document(); Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java (working copy) @@ -23,7 +23,7 @@ import java.util.List; import java.util.Random; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; @@ -75,7 +75,7 @@ boolean optimize = true; Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); // create the index createIndexNoClose(!optimize, "index1", writer); @@ -109,7 +109,7 @@ assertEquals(0, count(new Term("id", id10), r3)); assertEquals(1, count(new Term("id", Integer.toString(8000)), r3)); - writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("field", "a b c", Field.Store.NO, Field.Index.ANALYZED)); writer.addDocument(doc); @@ -136,7 +136,7 @@ boolean optimize = false; Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); // create the index createIndexNoClose(!optimize, "index1", writer); @@ -144,7 +144,7 @@ // create a 2nd index Directory dir2 = new MockRAMDirectory(); - IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer2.setInfoStream(infoStream); createIndexNoClose(!optimize, "index2", writer2); writer2.close(); @@ -181,12 +181,12 @@ boolean optimize = false; Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); // create a 2nd index Directory dir2 = new MockRAMDirectory(); - IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer2.setInfoStream(infoStream); createIndexNoClose(!optimize, "index2", writer2); writer2.close(); @@ -214,7 +214,7 @@ boolean optimize = true; Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); // create the index createIndexNoClose(!optimize, "index1", writer); @@ -252,7 +252,7 @@ writer.close(); // reopen the writer to verify the delete made it to the directory - writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); IndexReader w2r1 = writer.getReader(); assertEquals(0, count(new Term("id", id10), w2r1)); @@ -266,7 +266,7 @@ int numDirs = 3; Directory mainDir = new MockRAMDirectory(); - IndexWriter mainWriter = new IndexWriter(mainDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter mainWriter = new IndexWriter(mainDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); mainWriter.setInfoStream(infoStream); AddDirectoriesThreads addDirThreads = new AddDirectoriesThreads(numIter, mainWriter); addDirThreads.launchThreads(numDirs); @@ -309,7 +309,7 @@ this.numDirs = numDirs; this.mainWriter = mainWriter; addDir = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(addDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(2)); + IndexWriter writer = new IndexWriter(addDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(2)); for (int i = 0; i < NUM_INIT_DOCS; i++) { Document doc = createDocument(i, "addindex", 4); writer.addDocument(doc); @@ -415,7 +415,7 @@ */ public void doTestIndexWriterReopenSegment(boolean optimize) throws Exception { Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); IndexReader r1 = writer.getReader(); assertEquals(0, r1.maxDoc()); @@ -452,7 +452,7 @@ writer.close(); // test whether the changes made it to the directory - writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); IndexReader w2r1 = writer.getReader(); // insure the deletes were actually flushed to the directory assertEquals(200, w2r1.maxDoc()); @@ -492,7 +492,7 @@ public static void createIndex(Directory dir1, String indexName, boolean multiSegment) throws IOException { IndexWriter w = new IndexWriter(dir1, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMergePolicy(new LogDocMergePolicy())); for (int i = 0; i < 100; i++) { w.addDocument(createDocument(i, indexName, 4)); @@ -529,7 +529,7 @@ // Enroll warmer MyWarmer warmer = new MyWarmer(); IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMaxBufferedDocs(2).setMergedSegmentWarmer(warmer)); writer.setInfoStream(infoStream); @@ -560,7 +560,7 @@ public void testAfterCommit() throws Exception { Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.commit(); writer.setInfoStream(infoStream); @@ -593,7 +593,7 @@ // Make sure reader remains usable even if IndexWriter closes public void testAfterClose() throws Exception { Directory dir1 = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); // create the index @@ -622,7 +622,7 @@ // Stress test reopen during addIndexes public void testDuringAddIndexes() throws Exception { Directory dir1 = new MockRAMDirectory(); - final IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + final IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); @@ -699,7 +699,7 @@ // Stress test reopen during add/delete public void testDuringAddDelete() throws Exception { Directory dir1 = new MockRAMDirectory(); - final IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + final IndexWriter writer = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); writer.setInfoStream(infoStream); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); @@ -779,7 +779,7 @@ public void testExpungeDeletes() throws Throwable { Directory dir = new MockRAMDirectory(); - final IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + final IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("field", "a b c", Field.Store.NO, Field.Index.ANALYZED)); Field id = new Field("id", "", Field.Store.NO, Field.Index.NOT_ANALYZED); @@ -803,7 +803,7 @@ public void testDeletesNumDocs() throws Throwable { Directory dir = new MockRAMDirectory(); - final IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + final IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document doc = new Document(); doc.add(new Field("field", "a b c", Field.Store.NO, Field.Index.ANALYZED)); Field id = new Field("id", "", Field.Store.NO, Field.Index.NOT_ANALYZED); @@ -833,7 +833,7 @@ public void testEmptyIndex() throws Exception { // Ensures that getReader works on an empty index, which hasn't been committed yet. Directory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); IndexReader r = w.getReader(); assertEquals(0, r.numDocs()); r.close(); Index: lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java (working copy) @@ -19,7 +19,7 @@ import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -190,7 +190,7 @@ private void addDoc(RAMDirectory ramDir1, String s, boolean create) throws IOException { IndexWriter iw = new IndexWriter(ramDir1, new IndexWriterConfig( TEST_VERSION_CURRENT, - new StandardAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( create ? OpenMode.CREATE : OpenMode.APPEND)); Document doc = new Document(); doc.add(new Field("body", s, Field.Store.YES, Field.Index.ANALYZED)); Index: lucene/src/test/org/apache/lucene/index/TestFieldsReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (working copy) @@ -24,7 +24,7 @@ import java.util.List; import java.util.Set; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldSelector; @@ -60,7 +60,7 @@ fieldInfos = new FieldInfos(); DocHelper.setupDoc(testDoc); fieldInfos.add(testDoc); - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()); ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(false); ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundDocStore(false); IndexWriter writer = new IndexWriter(dir, conf); @@ -217,7 +217,7 @@ FSDirectory tmpDir = FSDirectory.open(file); assertTrue(tmpDir != null); - IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE); + IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE); ((LogMergePolicy) conf.getMergePolicy()).setUseCompoundFile(false); IndexWriter writer = new IndexWriter(tmpDir, conf); writer.addDocument(testDoc); @@ -398,7 +398,7 @@ try { Directory dir = new FaultyFSDirectory(indexDir); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)); + TEST_VERSION_CURRENT, new _TestAnalyzer()).setOpenMode(OpenMode.CREATE)); for(int i=0;i<2;i++) writer.addDocument(testDoc); writer.optimize(); Index: lucene/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestNRTReaderWithThreads.java (working copy) @@ -19,7 +19,7 @@ import java.util.Random; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.index.TestIndexWriterReader.HeavyAtomicInt; import org.apache.lucene.store.Directory; @@ -32,7 +32,7 @@ public void testIndexing() throws Exception { Directory mainDir = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(mainDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMaxBufferedDocs(10)); + IndexWriter writer = new IndexWriter(mainDir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setMaxBufferedDocs(10)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundFile(false); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setUseCompoundDocStore(false); Index: lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java (working copy) @@ -27,7 +27,7 @@ import java.util.HashMap; import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.store.Directory; @@ -65,7 +65,7 @@ throw new RuntimeException("Couldn't find commit point "+id); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexDeletionPolicy( + TEST_VERSION_CURRENT, new _TestAnalyzer()).setIndexDeletionPolicy( new RollbackDeletionPolicy(id)).setIndexCommit(last)); Map data = new HashMap(); data.put("index", "Rolled back to 1-"+id); @@ -127,7 +127,7 @@ //Build index, of records 1 to 100, committing after each batch of 10 IndexDeletionPolicy sdp=new KeepAllDeletionPolicy(); - IndexWriter w=new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexDeletionPolicy(sdp)); + IndexWriter w=new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setIndexDeletionPolicy(sdp)); for(int currentRecordId=1;currentRecordId<=100;currentRecordId++) { Document doc=new Document(); doc.add(new Field(FIELD_RECORD_ID,""+currentRecordId,Field.Store.YES,Field.Index.ANALYZED)); @@ -195,7 +195,7 @@ for(int i=0;i<2;i++) { // Unless you specify a prior commit point, rollback // should not work: - new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(new DeleteLastCommitPolicy())).close(); IndexReader r = IndexReader.open(dir, true); assertEquals(100, r.numDocs()); Index: lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java (working copy) @@ -24,7 +24,7 @@ import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.MockRAMDirectory; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -97,7 +97,7 @@ */ public void testFilterIndexReader() throws Exception { RAMDirectory directory = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document d1 = new Document(); d1.add(new Field("default","one two", Field.Store.YES, Field.Index.ANALYZED)); Index: lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (working copy) @@ -31,8 +31,7 @@ import java.util.Set; import org.apache.lucene.analysis.KeywordAnalyzer; -import org.apache.lucene.analysis.WhitespaceAnalyzer; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Index; @@ -706,7 +705,7 @@ final int n = 30*_TestUtil.getRandomMultiplier(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); for (int i = 0; i < n; i++) { writer.addDocument(createDocument(i, 3)); } @@ -726,7 +725,7 @@ modifier.close(); } else { IndexWriter modifier = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); modifier.addDocument(createDocument(n + i, 6)); modifier.close(); } @@ -954,7 +953,7 @@ public static void createIndex(Directory dir, boolean multiSegment) throws IOException { IndexWriter.unlock(dir); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setMergePolicy(new LogDocMergePolicy())); for (int i = 0; i < 100; i++) { @@ -998,7 +997,7 @@ static void modifyIndex(int i, Directory dir) throws IOException { switch (i) { case 0: { - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); w.deleteDocuments(new Term("field2", "a11")); w.deleteDocuments(new Term("field2", "b30")); w.close(); @@ -1013,13 +1012,13 @@ break; } case 2: { - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); w.optimize(); w.close(); break; } case 3: { - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); w.addDocument(createDocument(101, 4)); w.optimize(); w.addDocument(createDocument(102, 4)); @@ -1035,7 +1034,7 @@ break; } case 5: { - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); w.addDocument(createDocument(101, 4)); w.close(); break; @@ -1197,7 +1196,7 @@ public void testReopenOnCommit() throws Throwable { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexDeletionPolicy(new KeepAllCommits())); + TEST_VERSION_CURRENT, new _TestAnalyzer()).setIndexDeletionPolicy(new KeepAllCommits())); for(int i=0;i<4;i++) { Document doc = new Document(); doc.add(new Field("id", ""+i, Field.Store.NO, Field.Index.NOT_ANALYZED)); Index: lucene/src/test/org/apache/lucene/index/TestStressIndexing.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestStressIndexing.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestStressIndexing.java (working copy) @@ -18,7 +18,7 @@ import org.apache.lucene.util.*; import org.apache.lucene.store.*; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.*; @@ -119,7 +119,7 @@ */ public void runStressTest(Directory directory, MergeScheduler mergeScheduler) throws Exception { IndexWriter modifier = new IndexWriter(directory, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(10).setMergeScheduler( mergeScheduler)); modifier.commit(); Index: lucene/src/test/org/apache/lucene/index/TestPayloads.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestPayloads.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestPayloads.java (working copy) @@ -30,7 +30,7 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.TokenStream; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.analysis.WhitespaceTokenizer; import org.apache.lucene.analysis.tokenattributes.PayloadAttribute; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; @@ -486,7 +486,7 @@ Directory dir = new MockRAMDirectory(); final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); final String field = "test"; Thread[] ingesters = new Thread[numThreads]; Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (working copy) @@ -17,7 +17,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.MockRAMDirectory; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -57,7 +57,7 @@ Directory merged = new MockRAMDirectory(); - IndexWriter writer = new IndexWriter(merged, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter writer = new IndexWriter(merged, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); writer.addIndexesNoOptimize(new Directory[]{indexA, indexB}); @@ -95,7 +95,7 @@ IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, - new StandardAnalyzer(TEST_VERSION_CURRENT)) + new _TestAnalyzer()) .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(2)); ((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(2); Index: lucene/src/test/org/apache/lucene/index/TestLazyBug.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestLazyBug.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestLazyBug.java (working copy) @@ -24,7 +24,7 @@ import java.util.Random; import java.util.Set; -import org.apache.lucene.analysis.SimpleAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldSelector; @@ -72,7 +72,7 @@ try { Random r = newRandom(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new SimpleAnalyzer(TEST_VERSION_CURRENT))); + TEST_VERSION_CURRENT, new _TestAnalyzer())); LogMergePolicy lmp = (LogMergePolicy) writer.getConfig().getMergePolicy(); lmp.setUseCompoundFile(false); lmp.setUseCompoundDocStore(false); Index: lucene/src/test/org/apache/lucene/index/TestParallelReader.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestParallelReader.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestParallelReader.java (working copy) @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.Collection; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.MapFieldSelector; @@ -106,7 +106,7 @@ // one document only: Directory dir2 = new MockRAMDirectory(); - IndexWriter w2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document d3 = new Document(); d3.add(new Field("f3", "v1", Field.Store.YES, Field.Index.ANALYZED)); w2.addDocument(d3); @@ -151,13 +151,13 @@ Directory dir2 = getDir2(); // add another document to ensure that the indexes are not optimized - IndexWriter modifier = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter modifier = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document d = new Document(); d.add(new Field("f1", "v1", Field.Store.YES, Field.Index.ANALYZED)); modifier.addDocument(d); modifier.close(); - modifier = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + modifier = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); d = new Document(); d.add(new Field("f2", "v2", Field.Store.YES, Field.Index.ANALYZED)); modifier.addDocument(d); @@ -170,7 +170,7 @@ assertFalse(pr.isOptimized()); pr.close(); - modifier = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + modifier = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); modifier.optimize(); modifier.close(); @@ -182,7 +182,7 @@ pr.close(); - modifier = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + modifier = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); modifier.optimize(); modifier.close(); @@ -233,7 +233,7 @@ // Fields 1-4 indexed together: private Searcher single() throws IOException { Directory dir = new MockRAMDirectory(); - IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document d1 = new Document(); d1.add(new Field("f1", "v1", Field.Store.YES, Field.Index.ANALYZED)); d1.add(new Field("f2", "v1", Field.Store.YES, Field.Index.ANALYZED)); @@ -263,7 +263,7 @@ private Directory getDir1() throws IOException { Directory dir1 = new MockRAMDirectory(); - IndexWriter w1 = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w1 = new IndexWriter(dir1, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document d1 = new Document(); d1.add(new Field("f1", "v1", Field.Store.YES, Field.Index.ANALYZED)); d1.add(new Field("f2", "v1", Field.Store.YES, Field.Index.ANALYZED)); @@ -278,7 +278,7 @@ private Directory getDir2() throws IOException { Directory dir2 = new RAMDirectory(); - IndexWriter w2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new StandardAnalyzer(TEST_VERSION_CURRENT))); + IndexWriter w2 = new IndexWriter(dir2, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer())); Document d3 = new Document(); d3.add(new Field("f3", "v1", Field.Store.YES, Field.Index.ANALYZED)); d3.add(new Field("f4", "v1", Field.Store.YES, Field.Index.ANALYZED)); Index: lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java (revision 943145) +++ lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java (working copy) @@ -23,7 +23,7 @@ import java.util.Set; import java.util.Collection; -import org.apache.lucene.analysis.WhitespaceAnalyzer; +import org.apache.lucene.analysis._TestAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; @@ -203,7 +203,7 @@ Directory dir = new RAMDirectory(); ExpirationTimeDeletionPolicy policy = new ExpirationTimeDeletionPolicy(dir, SECONDS); IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + new _TestAnalyzer()) .setIndexDeletionPolicy(policy); LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy(); lmp.setUseCompoundFile(useCompoundFile); @@ -217,7 +217,7 @@ // past commits lastDeleteTime = System.currentTimeMillis(); conf = new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setIndexDeletionPolicy(policy); lmp = (LogMergePolicy) conf.getMergePolicy(); lmp.setUseCompoundFile(useCompoundFile); @@ -283,7 +283,7 @@ policy.dir = dir; IndexWriterConfig conf = new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(policy).setMaxBufferedDocs(10) .setMergeScheduler(new SerialMergeScheduler()); LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy(); @@ -296,7 +296,7 @@ writer.close(); conf = new IndexWriterConfig(TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setIndexDeletionPolicy(policy); lmp = (LogMergePolicy) conf.getMergePolicy(); lmp.setUseCompoundFile(useCompoundFile); @@ -340,7 +340,7 @@ int preCount = dir.listAll().length; writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, - new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode( + new _TestAnalyzer()).setOpenMode( OpenMode.APPEND).setIndexDeletionPolicy(policy)); writer.close(); int postCount = dir.listAll().length; @@ -364,7 +364,7 @@ policy.dir = dir; IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(policy).setMaxBufferedDocs(2)); for(int i=0;i<10;i++) { addDoc(writer); @@ -383,7 +383,7 @@ assertTrue(lastCommit != null); // Now add 1 doc and optimize - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexDeletionPolicy(policy)); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setIndexDeletionPolicy(policy)); addDoc(writer); assertEquals(11, writer.numDocs()); writer.optimize(); @@ -392,7 +392,7 @@ assertEquals(6, IndexReader.listCommits(dir).size()); // Now open writer on the commit just before optimize: - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(policy).setIndexCommit(lastCommit)); assertEquals(10, writer.numDocs()); @@ -405,7 +405,7 @@ assertEquals(11, r.numDocs()); r.close(); - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()) .setIndexDeletionPolicy(policy).setIndexCommit(lastCommit)); assertEquals(10, writer.numDocs()); // Commits the rollback: @@ -422,7 +422,7 @@ r.close(); // Reoptimize - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexDeletionPolicy(policy)); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setIndexDeletionPolicy(policy)); writer.optimize(); writer.close(); @@ -433,7 +433,7 @@ // Now open writer on the commit just before optimize, // but this time keeping only the last commit: - writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setIndexCommit(lastCommit)); + writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()).setIndexCommit(lastCommit)); assertEquals(10, writer.numDocs()); // Reader still sees optimized index, because writer @@ -470,7 +470,7 @@ Directory dir = new RAMDirectory(); IndexWriterConfig conf = new IndexWriterConfig( - TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.CREATE).setIndexDeletionPolicy(policy) .setMaxBufferedDocs(10); LogMergePolicy lmp = (LogMergePolicy) conf.getMergePolicy(); @@ -482,7 +482,7 @@ } writer.close(); - conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)) + conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new _TestAnalyzer()) .setOpenMode(OpenMode.APPEND).setIndexDeletionPolicy(policy); lmp = (LogMergePolicy) conf.getMergePolicy(); lmp.setUseCompoundFile(useCompoundFile); @@ -522,7 +522,7 @@ for(int j=0;j