Index: modules/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java =================================================================== --- modules/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java (revision 1140347) +++ modules/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java (working copy) @@ -18,12 +18,14 @@ */ import java.io.IOException; +import java.io.Reader; import java.util.ArrayList; import java.util.Comparator; import java.util.Iterator; import java.util.List; -import org.apache.lucene.analysis.core.WhitespaceAnalyzer; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexReader; @@ -112,6 +114,17 @@ private StringDistance sd; private Comparator comparator; + + /** we don't need to actually analyze any content: + * all fields are indexed NOT_ANALYZED, but docsinverter + * needs this for the offset gap! + */ + private static Analyzer noAnalyzer = new Analyzer() { + @Override + public TokenStream tokenStream(String fieldName, Reader reader) { + return null; + } + }; /** * Use the given directory as a spell checker index. The directory @@ -168,7 +181,7 @@ if (!IndexReader.indexExists(spellIndexDir)) { IndexWriter writer = new IndexWriter(spellIndexDir, new IndexWriterConfig(Version.LUCENE_CURRENT, - new WhitespaceAnalyzer(Version.LUCENE_CURRENT))); + noAnalyzer)); writer.close(); } swapSearcher(spellIndexDir); @@ -466,7 +479,7 @@ final Directory dir = this.spellIndex; final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( Version.LUCENE_CURRENT, - new WhitespaceAnalyzer(Version.LUCENE_CURRENT)) + noAnalyzer) .setOpenMode(OpenMode.CREATE)); writer.close(); swapSearcher(dir); @@ -503,7 +516,7 @@ synchronized (modifyCurrentIndexLock) { ensureOpen(); final Directory dir = this.spellIndex; - final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_CURRENT, new WhitespaceAnalyzer(Version.LUCENE_CURRENT)).setRAMBufferSizeMB(ramMB)); + final IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_CURRENT, noAnalyzer).setRAMBufferSizeMB(ramMB)); ((TieredMergePolicy) writer.getConfig().getMergePolicy()).setMaxMergeAtOnce(mergeFactor); IndexSearcher indexSearcher = obtainSearcher(); final List termsEnums = new ArrayList(); Index: modules/suggest/build.xml =================================================================== --- modules/suggest/build.xml (revision 1140347) +++ modules/suggest/build.xml (working copy) @@ -29,21 +29,5 @@ - - - - - - - - - - - - - - -