Hi,

Also Tokenizer no longer has a Reader in its ctor. Tokenizers are constructed 
without any reader. To consume the TokenStream one has to set the reader using 
setReader(Reader). Because of that createComponents does not need to get a 
Reader, too.

The tokenStream method takes a String or Reader and will pass this to 
Tokenizer#setReader().

This is from http://lucene.apache.org/core/5_0_0/MIGRATE.html:
"Removed Reader from Tokenizer constructor (LUCENE-5388): The constructor of 
Tokenizer no longer takes Reader, as this was a leftover from before it was 
reusable. See the org.apache.lucene.analysis package documentation for more 
details."

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Clemens Wyss DEV [mailto:clemens...@mysign.ch]
> Sent: Monday, February 23, 2015 1:18 PM
> To: java-user@lucene.apache.org
> Subject: AW: Lucene 5 : createComponents without reader
> 
> Got this one sorted out. I was still referencing the 4.x lucene-analyzers.jar
> which required the reader ;) Sorry for the noise!
> 
> -----Ursprüngliche Nachricht-----
> Von: Clemens Wyss DEV [mailto:clemens...@mysign.ch]
> Gesendet: Montag, 23. Februar 2015 12:42
> An: java-user@lucene.apache.org
> Betreff: Lucene 5 : createComponents without reader
> 
> My custom Analyzer had the following (Lucene 4) impl of createComponents:
> protected TokenStreamComponents createComponents ( final String
> fieldName,
>                       final Reader reader )
>       {
>               Tokenizer source = new KeywordTokenizer( reader );
>               TokenStream filter = new LowerCaseFilter( source );
>               return new TokenStreamComponents( source, filter );
>       }
> As of Lucene 5 the signature of createComponents was changed to:
> TokenStreamComponents createComponents ( String fieldName )
> 
> How do I get the "current" reader in Lucene 5?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to