diff --git a/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java b/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java index 71189aefdb1..f03eca4c9fb 100644 --- a/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java +++ b/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java @@ -237,7 +237,7 @@ public class AnalyzerUtil { final ArrayList tokens = (ArrayList) cache.get(fieldName); if (tokens == null) { // not yet cached final ArrayList tokens2 = new ArrayList(); - TokenStream stream = new TokenFilter(child.tokenStream(fieldName, reader)) { + TokenStream tokenStream = new TokenFilter(child.tokenStream(fieldName, reader)) { public Token next() throws IOException { Token token = input.next(); // from filter super class @@ -245,8 +245,9 @@ public class AnalyzerUtil { return token; } }; + cache.put(fieldName, tokens2); - return stream; + return tokenStream; } else { // already cached return new TokenStream() {