lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whosc...@apache.org
Subject svn commit: r479754 - /lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java
Date Mon, 27 Nov 2006 20:34:45 GMT
Author: whoschek
Date: Mon Nov 27 12:34:45 2006
New Revision: 479754

URL: http://svn.apache.org/viewvc?view=rev&rev=479754
Log:
For repeatable exceptions, store into cache only if child.tokenStream(fieldName, reader) does
not throw an exception

Modified:
    lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java

Modified: lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java?view=diff&rev=479754&r1=479753&r2=479754
==============================================================================
--- lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java
(original)
+++ lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/AnalyzerUtil.java
Mon Nov 27 12:34:45 2006
@@ -237,8 +237,7 @@
         final ArrayList tokens = (ArrayList) cache.get(fieldName);
         if (tokens == null) { // not yet cached
           final ArrayList tokens2 = new ArrayList();
-          cache.put(fieldName, tokens2);
-          return new TokenFilter(child.tokenStream(fieldName, reader)) {
+          TokenStream stream = new TokenFilter(child.tokenStream(fieldName, reader)) {
 
             public Token next() throws IOException {
               Token token = input.next(); // from filter super class
@@ -246,6 +245,8 @@
               return token;
             }
           };
+          cache.put(fieldName, tokens2);
+          return stream;
         } else { // already cached
           return new TokenStream() {
 



Mime
View raw message