lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r803664 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/queryParser/QueryParser.java src/java/org/apache/lucene/queryParser/QueryParser.jj
Date Wed, 12 Aug 2009 18:53:49 GMT
Author: yonik
Date: Wed Aug 12 18:53:49 2009
New Revision: 803664

URL: http://svn.apache.org/viewvc?rev=803664&view=rev
Log:
LUCENE-1800: reusable token streams for query parser

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
    lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=803664&r1=803663&r2=803664&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Wed Aug 12 18:53:49 2009
@@ -727,6 +727,8 @@
     strings, the StringHelper.intern() interface was added with a
     default implementation that uses a lockless cache.
     (Earwin Burrfoot, yonik)
+
+13. LUCENE-1800: QueryParser should use reusable TokenStreams. (yonik)
     
 
 Documentation

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java?rev=803664&r1=803663&r2=803664&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java Wed Aug 12 18:53:49
2009
@@ -537,7 +537,13 @@
     // Use the analyzer to get all the tokens, and then build a TermQuery,
     // PhraseQuery, or nothing based on the term count
 
-    TokenStream source = analyzer.tokenStream(field, new StringReader(queryText));
+    TokenStream source;
+    try {
+      source = analyzer.reusableTokenStream(field, new StringReader(queryText));
+      source.reset();
+    } catch (IOException e) {
+      source = analyzer.tokenStream(field, new StringReader(queryText));
+    }
     CachingTokenFilter buffer = new CachingTokenFilter(source);
     TermAttribute termAtt = null;
     PositionIncrementAttribute posIncrAtt = null;

Modified: lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj?rev=803664&r1=803663&r2=803664&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj Wed Aug 12 18:53:49
2009
@@ -562,7 +562,13 @@
     // Use the analyzer to get all the tokens, and then build a TermQuery,
     // PhraseQuery, or nothing based on the term count
 
-    TokenStream source = analyzer.tokenStream(field, new StringReader(queryText));
+    TokenStream source;
+    try {
+      source = analyzer.reusableTokenStream(field, new StringReader(queryText));
+      source.reset();
+    } catch (IOException e) {
+      source = analyzer.tokenStream(field, new StringReader(queryText));
+    }
     CachingTokenFilter buffer = new CachingTokenFilter(source);
     TermAttribute termAtt = null;
     PositionIncrementAttribute posIncrAtt = null;



Mime
View raw message