lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: how to reuse a tokenStream?
Date Fri, 28 May 2010 13:57:05 GMT
What is the problem you're seeing? Maybe a stack trace?
You haven't told us what the incorrect behavior is.

Best
Erick

On Fri, May 28, 2010 at 12:52 AM, Li Li <fancyerii@gmail.com> wrote:

> I want to analyzer a text twice so that I can get some statistic
> information from this text
>                                TokenStream tokenStream=null;
>                Analyzer wa=new WhitespaceAnalyzer();
>                try {
>                        tokenStream = wa.reusableTokenStream(fieldName,
> reader);
>                        while(tokenStream.incrementToken()){
>                                //do something
>                        }
>                } catch (IOException e1) {
>                        e1.printStackTrace();
>                }
>
>                try {
>                                                tokenStream.reset();
>                        //tokenStream = wa.reusableTokenStream(fieldName,
> reader);
>                        while(tokenStream.incrementToken()){
>                                                                //not here
>                                System.out.println("resuable");
>
>                        }
>                } catch (IOException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message