lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: reset versus setReader on TokenStream
Date Wed, 29 Aug 2012 20:28:53 GMT
> To me, it seemed natural to overload #setReader so that our tokenizer was in a
> consistent state once it was called. It occurs to me to wonder about
> order: if #reset is called before #setReader, I'm up creek unless I copy my reset
> implementation into a local override of #setReader.

The order is defined in TokenStream and Tokenizer JavaDocs. First call setReader on the Tokenizer
and after that the *consumer* has to call reset() on the chain of filters. When a user uses
your Tokenizer, he will set a new Reader and then pass it to the indexer. Indexer (the consumer)
will then call reset() before incrementToken() is called for the first time. In Lucene's BaseTokenStreamTestcase,
this is asserted to be correct.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message